1. Packages
  2. stackit
  3. API Docs
  4. SecurityGroup
Viewing docs for stackit v0.0.4
published on Friday, Feb 20, 2026 by stackitcloud
stackit logo
Viewing docs for stackit v0.0.4
published on Friday, Feb 20, 2026 by stackitcloud

    Security group resource schema. Must have a region specified in the provider configuration.

    Example Usage

    resource "stackit_security_group" "example" {
      project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
      name       = "my_security_group"
      labels = {
        "key" = "value"
      }
    }
    
    # Only use the import statement, if you want to import an existing security group
    import {
      to = stackit_security_group.import-example
      id = "${var.project_id},${var.security_group_id}"
    }
    

    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: SecurityGroupArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def SecurityGroup(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project_id: Optional[str] = None,
                      description: Optional[str] = None,
                      labels: Optional[Mapping[str, str]] = None,
                      name: Optional[str] = None,
                      region: Optional[str] = None,
                      stateful: Optional[bool] = None)
    func NewSecurityGroup(ctx *Context, name string, args SecurityGroupArgs, opts ...ResourceOption) (*SecurityGroup, error)
    public SecurityGroup(string name, SecurityGroupArgs args, CustomResourceOptions? opts = null)
    public SecurityGroup(String name, SecurityGroupArgs args)
    public SecurityGroup(String name, SecurityGroupArgs args, CustomResourceOptions options)
    
    type: stackit: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 Stackit.SecurityGroup("securityGroupResource", new()
    {
        ProjectId = "string",
        Description = "string",
        Labels = 
        {
            { "string", "string" },
        },
        Name = "string",
        Region = "string",
        Stateful = false,
    });
    
    example, err := stackit.NewSecurityGroup(ctx, "securityGroupResource", &stackit.SecurityGroupArgs{
    	ProjectId:   pulumi.String("string"),
    	Description: pulumi.String("string"),
    	Labels: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    	Name:     pulumi.String("string"),
    	Region:   pulumi.String("string"),
    	Stateful: pulumi.Bool(false),
    })
    
    var securityGroupResource = new SecurityGroup("securityGroupResource", SecurityGroupArgs.builder()
        .projectId("string")
        .description("string")
        .labels(Map.of("string", "string"))
        .name("string")
        .region("string")
        .stateful(false)
        .build());
    
    security_group_resource = stackit.SecurityGroup("securityGroupResource",
        project_id="string",
        description="string",
        labels={
            "string": "string",
        },
        name="string",
        region="string",
        stateful=False)
    
    const securityGroupResource = new stackit.SecurityGroup("securityGroupResource", {
        projectId: "string",
        description: "string",
        labels: {
            string: "string",
        },
        name: "string",
        region: "string",
        stateful: false,
    });
    
    type: stackit:SecurityGroup
    properties:
        description: string
        labels:
            string: string
        name: string
        projectId: string
        region: string
        stateful: false
    

    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:

    ProjectId string
    STACKIT project ID to which the security group is associated.
    Description string
    The description of the security group.
    Labels Dictionary<string, string>
    Labels are key-value string pairs which can be attached to a resource container
    Name string
    The name of the security group.
    Region string
    The resource region. If not defined, the provider region is used.
    Stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    ProjectId string
    STACKIT project ID to which the security group is associated.
    Description string
    The description of the security group.
    Labels map[string]string
    Labels are key-value string pairs which can be attached to a resource container
    Name string
    The name of the security group.
    Region string
    The resource region. If not defined, the provider region is used.
    Stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    projectId String
    STACKIT project ID to which the security group is associated.
    description String
    The description of the security group.
    labels Map<String,String>
    Labels are key-value string pairs which can be attached to a resource container
    name String
    The name of the security group.
    region String
    The resource region. If not defined, the provider region is used.
    stateful Boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    projectId string
    STACKIT project ID to which the security group is associated.
    description string
    The description of the security group.
    labels {[key: string]: string}
    Labels are key-value string pairs which can be attached to a resource container
    name string
    The name of the security group.
    region string
    The resource region. If not defined, the provider region is used.
    stateful boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    project_id str
    STACKIT project ID to which the security group is associated.
    description str
    The description of the security group.
    labels Mapping[str, str]
    Labels are key-value string pairs which can be attached to a resource container
    name str
    The name of the security group.
    region str
    The resource region. If not defined, the provider region is used.
    stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    projectId String
    STACKIT project ID to which the security group is associated.
    description String
    The description of the security group.
    labels Map<String>
    Labels are key-value string pairs which can be attached to a resource container
    name String
    The name of the security group.
    region String
    The resource region. If not defined, the provider region is used.
    stateful Boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.

    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.
    SecurityGroupId string
    The security group ID.
    Id string
    The provider-assigned unique ID for this managed resource.
    SecurityGroupId string
    The security group ID.
    id String
    The provider-assigned unique ID for this managed resource.
    securityGroupId String
    The security group ID.
    id string
    The provider-assigned unique ID for this managed resource.
    securityGroupId string
    The security group ID.
    id str
    The provider-assigned unique ID for this managed resource.
    security_group_id str
    The security group ID.
    id String
    The provider-assigned unique ID for this managed resource.
    securityGroupId String
    The security group ID.

    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,
            labels: Optional[Mapping[str, str]] = None,
            name: Optional[str] = None,
            project_id: Optional[str] = None,
            region: Optional[str] = None,
            security_group_id: Optional[str] = None,
            stateful: Optional[bool] = 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: stackit: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.
    The following state arguments are supported:
    Description string
    The description of the security group.
    Labels Dictionary<string, string>
    Labels are key-value string pairs which can be attached to a resource container
    Name string
    The name of the security group.
    ProjectId string
    STACKIT project ID to which the security group is associated.
    Region string
    The resource region. If not defined, the provider region is used.
    SecurityGroupId string
    The security group ID.
    Stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    Description string
    The description of the security group.
    Labels map[string]string
    Labels are key-value string pairs which can be attached to a resource container
    Name string
    The name of the security group.
    ProjectId string
    STACKIT project ID to which the security group is associated.
    Region string
    The resource region. If not defined, the provider region is used.
    SecurityGroupId string
    The security group ID.
    Stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    description String
    The description of the security group.
    labels Map<String,String>
    Labels are key-value string pairs which can be attached to a resource container
    name String
    The name of the security group.
    projectId String
    STACKIT project ID to which the security group is associated.
    region String
    The resource region. If not defined, the provider region is used.
    securityGroupId String
    The security group ID.
    stateful Boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    description string
    The description of the security group.
    labels {[key: string]: string}
    Labels are key-value string pairs which can be attached to a resource container
    name string
    The name of the security group.
    projectId string
    STACKIT project ID to which the security group is associated.
    region string
    The resource region. If not defined, the provider region is used.
    securityGroupId string
    The security group ID.
    stateful boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    description str
    The description of the security group.
    labels Mapping[str, str]
    Labels are key-value string pairs which can be attached to a resource container
    name str
    The name of the security group.
    project_id str
    STACKIT project ID to which the security group is associated.
    region str
    The resource region. If not defined, the provider region is used.
    security_group_id str
    The security group ID.
    stateful bool
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.
    description String
    The description of the security group.
    labels Map<String>
    Labels are key-value string pairs which can be attached to a resource container
    name String
    The name of the security group.
    projectId String
    STACKIT project ID to which the security group is associated.
    region String
    The resource region. If not defined, the provider region is used.
    securityGroupId String
    The security group ID.
    stateful Boolean
    Configures if a security group is stateful or stateless. There can only be one type of security groups per network interface/server.

    Package Details

    Repository
    stackit stackitcloud/pulumi-stackit
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the stackit Terraform Provider.
    stackit logo
    Viewing docs for stackit v0.0.4
    published on Friday, Feb 20, 2026 by stackitcloud
      Try Pulumi Cloud free. Your team will thank you.