Class SecurityGroup


  • public class SecurityGroup
    extends com.pulumi.resources.CustomResource
    Provides a Security Group resource. For information about Security Group and how to use it, see [What is Security Group](https://www.alibabacloud.com/help/en/ecs/developer-reference/api-createsecuritygroup). > **NOTE:** Available since v1.0.0. > **NOTE:** `alicloud.ecs.SecurityGroup` is used to build and manage a security group, and `alicloud.ecs.SecurityGroupRule` can define ingress or egress rules for it. > **NOTE:** From version 1.7.2, `alicloud.ecs.SecurityGroup` has supported to segregate different ECS instance in which the same security group. ## Example Usage Basic Usage ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.ecs.SecurityGroup; import com.pulumi.alicloud.ecs.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 default_ = new SecurityGroup("default", SecurityGroupArgs.builder() .description("New security group") .build()); } } ``` Basic Usage for VPC ```java package generated_program; import com.pulumi.Context; import com.pulumi.Pulumi; import com.pulumi.core.Output; import com.pulumi.alicloud.vpc.Network; import com.pulumi.alicloud.vpc.NetworkArgs; import com.pulumi.alicloud.ecs.SecurityGroup; import com.pulumi.alicloud.ecs.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 vpc = new Network("vpc", NetworkArgs.builder() .vpcName("terraform-example") .cidrBlock("10.1.0.0/21") .build()); var group = new SecurityGroup("group", SecurityGroupArgs.builder() .vpcId(vpc.id()) .build()); } } ``` ## Module Support You can use the existing security-group module to create a security group and add several rules one-click. ## Import Security Group can be imported using the id, e.g. ```sh $ pulumi import alicloud:ecs/securityGroup:SecurityGroup example sg-abc123456 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()  
      static SecurityGroup get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, SecurityGroupState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.lang.Boolean> innerAccess()  
      com.pulumi.core.Output<java.lang.String> innerAccessPolicy()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> resourceGroupId()  
      com.pulumi.core.Output<java.lang.String> securityGroupType()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.Object>>> tags()  
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> vpcId()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SecurityGroup

        public SecurityGroup​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • SecurityGroup

        public SecurityGroup​(java.lang.String name,
                             @Nullable
                             SecurityGroupArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • SecurityGroup

        public SecurityGroup​(java.lang.String name,
                             @Nullable
                             SecurityGroupArgs args,
                             @Nullable
                             com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • description

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> description()
        Returns:
        The security group description. Defaults to null.
      • innerAccess

        public com.pulumi.core.Output<java.lang.Boolean> innerAccess()
        Returns:
        Field `inner_access` has been deprecated from provider version 1.55.3. New field `inner_access_policy` instead. Combining security group rules, the policy can define multiple application scenario. Default to true. It is valid from version `1.7.2`.
      • innerAccessPolicy

        public com.pulumi.core.Output<java.lang.String> innerAccessPolicy()
        Returns:
        The internal access control policy of the security group. Valid values: `Accept`, `Drop`.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        The name of the security group. Defaults to null.
      • resourceGroupId

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> resourceGroupId()
        Returns:
        The ID of the resource group to which the security group belongs. **NOTE:** From version 1.115.0, `resource_group_id` can be modified.
      • securityGroupType

        public com.pulumi.core.Output<java.lang.String> securityGroupType()
        Returns:
        The type of the security group. Valid values:
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.Object>>> tags()
        Returns:
        A mapping of tags to assign to the resource.
      • vpcId

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> vpcId()
        Returns:
        The ID of the VPC.
      • get

        public static SecurityGroup get​(java.lang.String name,
                                        com.pulumi.core.Output<java.lang.String> id,
                                        @Nullable
                                        SecurityGroupState state,
                                        @Nullable
                                        com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.