ibm.SecurityGroup
Explore with Pulumi AI
Create, delete, and update a security group. Provides a networking security group resource that controls access to the public and private interfaces of a virtual server instance. To create rules for the security group, use the security_group_rule
resource. For more information, about security group, see managing security groups.
For more information, see IBM Cloud Classic Infrastructure (SoftLayer) API docs.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as ibm from "@pulumi/ibm";
const sg1 = new ibm.SecurityGroup("sg1", {description: "allow my app traffic"});
import pulumi
import pulumi_ibm as ibm
sg1 = ibm.SecurityGroup("sg1", description="allow my app traffic")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/ibm/ibm"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ibm.NewSecurityGroup(ctx, "sg1", &ibm.SecurityGroupArgs{
Description: pulumi.String("allow my app traffic"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Ibm = Pulumi.Ibm;
return await Deployment.RunAsync(() =>
{
var sg1 = new Ibm.SecurityGroup("sg1", new()
{
Description = "allow my app traffic",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.ibm.SecurityGroup;
import com.pulumi.ibm.SecurityGroupArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var sg1 = new SecurityGroup("sg1", SecurityGroupArgs.builder()
.description("allow my app traffic")
.build());
}
}
resources:
sg1:
type: ibm:SecurityGroup
properties:
description: allow my app traffic
Argument reference
Review the argument references that you can specify for your resource.
name
- (Required, Forces new resource, String)The descriptive name that is used to identify the security group.description
- (Optional, String) More details to describe the security group.
Create SecurityGroup Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new SecurityGroup(name: string, args?: SecurityGroupArgs, opts?: CustomResourceOptions);
@overload
def SecurityGroup(resource_name: str,
args: Optional[SecurityGroupArgs] = None,
opts: Optional[ResourceOptions] = None)
@overload
def SecurityGroup(resource_name: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
security_group_id: Optional[str] = None)
func NewSecurityGroup(ctx *Context, name string, args *SecurityGroupArgs, opts ...ResourceOption) (*SecurityGroup, error)
public SecurityGroup(string name, SecurityGroupArgs? args = null, CustomResourceOptions? opts = null)
public SecurityGroup(String name, SecurityGroupArgs args)
public SecurityGroup(String name, SecurityGroupArgs args, CustomResourceOptions options)
type: ibm:SecurityGroup
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args SecurityGroupArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var securityGroupResource = new Ibm.SecurityGroup("securityGroupResource", new()
{
Description = "string",
Name = "string",
SecurityGroupId = "string",
});
example, err := ibm.NewSecurityGroup(ctx, "securityGroupResource", &ibm.SecurityGroupArgs{
Description: pulumi.String("string"),
Name: pulumi.String("string"),
SecurityGroupId: pulumi.String("string"),
})
var securityGroupResource = new SecurityGroup("securityGroupResource", SecurityGroupArgs.builder()
.description("string")
.name("string")
.securityGroupId("string")
.build());
security_group_resource = ibm.SecurityGroup("securityGroupResource",
description="string",
name="string",
security_group_id="string")
const securityGroupResource = new ibm.SecurityGroup("securityGroupResource", {
description: "string",
name: "string",
securityGroupId: "string",
});
type: ibm:SecurityGroup
properties:
description: string
name: string
securityGroupId: string
SecurityGroup Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The SecurityGroup resource accepts the following input properties:
- Description string
- Security group description
- Name string
- Security group name
- Security
Group stringId - (String) The unique identifier of the security group.
- Description string
- Security group description
- Name string
- Security group name
- Security
Group stringId - (String) The unique identifier of the security group.
- description String
- Security group description
- name String
- Security group name
- security
Group StringId - (String) The unique identifier of the security group.
- description string
- Security group description
- name string
- Security group name
- security
Group stringId - (String) The unique identifier of the security group.
- description str
- Security group description
- name str
- Security group name
- security_
group_ strid - (String) The unique identifier of the security group.
- description String
- Security group description
- name String
- Security group name
- security
Group StringId - (String) The unique identifier of the security group.
Outputs
All input properties are implicitly available as output properties. Additionally, the SecurityGroup resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing SecurityGroup Resource
Get an existing SecurityGroup resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: SecurityGroupState, opts?: CustomResourceOptions): SecurityGroup
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
security_group_id: Optional[str] = None) -> SecurityGroup
func GetSecurityGroup(ctx *Context, name string, id IDInput, state *SecurityGroupState, opts ...ResourceOption) (*SecurityGroup, error)
public static SecurityGroup Get(string name, Input<string> id, SecurityGroupState? state, CustomResourceOptions? opts = null)
public static SecurityGroup get(String name, Output<String> id, SecurityGroupState state, CustomResourceOptions options)
resources: _: type: ibm:SecurityGroup get: id: ${id}
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- Security group description
- Name string
- Security group name
- Security
Group stringId - (String) The unique identifier of the security group.
- Description string
- Security group description
- Name string
- Security group name
- Security
Group stringId - (String) The unique identifier of the security group.
- description String
- Security group description
- name String
- Security group name
- security
Group StringId - (String) The unique identifier of the security group.
- description string
- Security group description
- name string
- Security group name
- security
Group stringId - (String) The unique identifier of the security group.
- description str
- Security group description
- name str
- Security group name
- security_
group_ strid - (String) The unique identifier of the security group.
- description String
- Security group description
- name String
- Security group name
- security
Group StringId - (String) The unique identifier of the security group.
Package Details
- Repository
- ibm ibm-cloud/terraform-provider-ibm
- License
- Notes
- This Pulumi package is based on the
ibm
Terraform Provider.