github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/securityGroup.go (about)

     1  // Code generated by the Pulumi Terraform Bridge (tfgen) Tool DO NOT EDIT.
     2  // *** WARNING: Do not edit by hand unless you're certain you know what you are doing! ***
     3  
     4  package ec2
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    11  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    12  )
    13  
    14  // Provides a security group resource.
    15  //
    16  // > **NOTE on Security Groups and Security Group Rules:** This provider currently provides a Security Group resource with `ingress` and `egress` rules defined in-line and a Security Group Rule resource which manages one or more `ingress` or `egress` rules. Both of these resource were added before AWS assigned a [security group rule unique ID](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/security-group-rules.html), and they do not work well in all scenarios using the`description` and `tags` attributes, which rely on the unique ID. The `vpc.SecurityGroupEgressRule` and `vpc.SecurityGroupIngressRule` resources have been added to address these limitations and should be used for all new security group rules. You should not use the `vpc.SecurityGroupEgressRule` and `vpc.SecurityGroupIngressRule` resources in conjunction with an `ec2.SecurityGroup` resource with in-line rules or with `ec2.SecurityGroupRule` resources defined for the same Security Group, as rule conflicts may occur and rules will be overwritten.
    17  //
    18  // > **NOTE:** Referencing Security Groups across VPC peering has certain restrictions. More information is available in the [VPC Peering User Guide](https://docs.aws.amazon.com/vpc/latest/peering/vpc-peering-security-groups.html).
    19  //
    20  // > **NOTE:** Due to [AWS Lambda improved VPC networking changes that began deploying in September 2019](https://aws.amazon.com/blogs/compute/announcing-improved-vpc-networking-for-aws-lambda-functions/), security groups associated with Lambda Functions can take up to 45 minutes to successfully delete.
    21  //
    22  // > **NOTE:** The `cidrBlocks` and `ipv6CidrBlocks` parameters are optional in the `ingress` and `egress` blocks. If nothing is specified, traffic will be blocked as described in _NOTE on Egress rules_ later.
    23  //
    24  // ## Example Usage
    25  //
    26  // ### Basic Usage
    27  //
    28  // <!--Start PulumiCodeChooser -->
    29  // ```go
    30  // package main
    31  //
    32  // import (
    33  //
    34  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
    35  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/vpc"
    36  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    37  //
    38  // )
    39  //
    40  //	func main() {
    41  //		pulumi.Run(func(ctx *pulumi.Context) error {
    42  //			allowTls, err := ec2.NewSecurityGroup(ctx, "allow_tls", &ec2.SecurityGroupArgs{
    43  //				Name:        pulumi.String("allow_tls"),
    44  //				Description: pulumi.String("Allow TLS inbound traffic and all outbound traffic"),
    45  //				VpcId:       pulumi.Any(main.Id),
    46  //				Tags: pulumi.StringMap{
    47  //					"Name": pulumi.String("allow_tls"),
    48  //				},
    49  //			})
    50  //			if err != nil {
    51  //				return err
    52  //			}
    53  //			_, err = vpc.NewSecurityGroupIngressRule(ctx, "allow_tls_ipv4", &vpc.SecurityGroupIngressRuleArgs{
    54  //				SecurityGroupId: allowTls.ID(),
    55  //				CidrIpv4:        pulumi.Any(main.CidrBlock),
    56  //				FromPort:        pulumi.Int(443),
    57  //				IpProtocol:      pulumi.String("tcp"),
    58  //				ToPort:          pulumi.Int(443),
    59  //			})
    60  //			if err != nil {
    61  //				return err
    62  //			}
    63  //			_, err = vpc.NewSecurityGroupIngressRule(ctx, "allow_tls_ipv6", &vpc.SecurityGroupIngressRuleArgs{
    64  //				SecurityGroupId: allowTls.ID(),
    65  //				CidrIpv6:        pulumi.Any(main.Ipv6CidrBlock),
    66  //				FromPort:        pulumi.Int(443),
    67  //				IpProtocol:      pulumi.String("tcp"),
    68  //				ToPort:          pulumi.Int(443),
    69  //			})
    70  //			if err != nil {
    71  //				return err
    72  //			}
    73  //			_, err = vpc.NewSecurityGroupEgressRule(ctx, "allow_all_traffic_ipv4", &vpc.SecurityGroupEgressRuleArgs{
    74  //				SecurityGroupId: allowTls.ID(),
    75  //				CidrIpv4:        pulumi.String("0.0.0.0/0"),
    76  //				IpProtocol:      pulumi.String("-1"),
    77  //			})
    78  //			if err != nil {
    79  //				return err
    80  //			}
    81  //			_, err = vpc.NewSecurityGroupEgressRule(ctx, "allow_all_traffic_ipv6", &vpc.SecurityGroupEgressRuleArgs{
    82  //				SecurityGroupId: allowTls.ID(),
    83  //				CidrIpv6:        pulumi.String("::/0"),
    84  //				IpProtocol:      pulumi.String("-1"),
    85  //			})
    86  //			if err != nil {
    87  //				return err
    88  //			}
    89  //			return nil
    90  //		})
    91  //	}
    92  //
    93  // ```
    94  // <!--End PulumiCodeChooser -->
    95  //
    96  // > **NOTE on Egress rules:** By default, AWS creates an `ALLOW ALL` egress rule when creating a new Security Group inside of a VPC. When creating a new Security Group inside a VPC, **this provider will remove this default rule**, and require you specifically re-create it if you desire that rule. We feel this leads to fewer surprises in terms of controlling your egress rules. If you desire this rule to be in place, you can use this `egress` block:
    97  //
    98  // <!--Start PulumiCodeChooser -->
    99  // ```go
   100  // package main
   101  //
   102  // import (
   103  //
   104  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   105  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   106  //
   107  // )
   108  //
   109  //	func main() {
   110  //		pulumi.Run(func(ctx *pulumi.Context) error {
   111  //			_, err := ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
   112  //				Egress: ec2.SecurityGroupEgressArray{
   113  //					&ec2.SecurityGroupEgressArgs{
   114  //						FromPort: pulumi.Int(0),
   115  //						ToPort:   pulumi.Int(0),
   116  //						Protocol: pulumi.String("-1"),
   117  //						CidrBlocks: pulumi.StringArray{
   118  //							pulumi.String("0.0.0.0/0"),
   119  //						},
   120  //						Ipv6CidrBlocks: pulumi.StringArray{
   121  //							pulumi.String("::/0"),
   122  //						},
   123  //					},
   124  //				},
   125  //			})
   126  //			if err != nil {
   127  //				return err
   128  //			}
   129  //			return nil
   130  //		})
   131  //	}
   132  //
   133  // ```
   134  // <!--End PulumiCodeChooser -->
   135  //
   136  // ### Usage With Prefix List IDs
   137  //
   138  // Prefix Lists are either managed by AWS internally, or created by the customer using a
   139  // Prefix List resource. Prefix Lists provided by
   140  // AWS are associated with a prefix list name, or service name, that is linked to a specific region.
   141  // Prefix list IDs are exported on VPC Endpoints, so you can use this format:
   142  //
   143  // <!--Start PulumiCodeChooser -->
   144  // ```go
   145  // package main
   146  //
   147  // import (
   148  //
   149  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   150  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   151  //
   152  // )
   153  //
   154  //	func main() {
   155  //		pulumi.Run(func(ctx *pulumi.Context) error {
   156  //			myEndpoint, err := ec2.NewVpcEndpoint(ctx, "my_endpoint", nil)
   157  //			if err != nil {
   158  //				return err
   159  //			}
   160  //			_, err = ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
   161  //				Egress: ec2.SecurityGroupEgressArray{
   162  //					&ec2.SecurityGroupEgressArgs{
   163  //						FromPort: pulumi.Int(0),
   164  //						ToPort:   pulumi.Int(0),
   165  //						Protocol: pulumi.String("-1"),
   166  //						PrefixListIds: pulumi.StringArray{
   167  //							myEndpoint.PrefixListId,
   168  //						},
   169  //					},
   170  //				},
   171  //			})
   172  //			if err != nil {
   173  //				return err
   174  //			}
   175  //			return nil
   176  //		})
   177  //	}
   178  //
   179  // ```
   180  // <!--End PulumiCodeChooser -->
   181  //
   182  // You can also find a specific Prefix List using the `ec2.getPrefixList` data source.
   183  //
   184  // ### Removing All Ingress and Egress Rules
   185  //
   186  // The `ingress` and `egress` arguments are processed in attributes-as-blocks mode. Due to this, removing these arguments from the configuration will **not** cause the provider to destroy the managed rules. To subsequently remove all managed ingress and egress rules:
   187  //
   188  // <!--Start PulumiCodeChooser -->
   189  // ```go
   190  // package main
   191  //
   192  // import (
   193  //
   194  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   195  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   196  //
   197  // )
   198  //
   199  //	func main() {
   200  //		pulumi.Run(func(ctx *pulumi.Context) error {
   201  //			_, err := ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
   202  //				Name:    pulumi.String("sg"),
   203  //				VpcId:   pulumi.Any(exampleAwsVpc.Id),
   204  //				Ingress: ec2.SecurityGroupIngressArray{},
   205  //				Egress:  ec2.SecurityGroupEgressArray{},
   206  //			})
   207  //			if err != nil {
   208  //				return err
   209  //			}
   210  //			return nil
   211  //		})
   212  //	}
   213  //
   214  // ```
   215  // <!--End PulumiCodeChooser -->
   216  //
   217  // ### Recreating a Security Group
   218  //
   219  // A simple security group `name` change "forces new" the security group--the provider destroys the security group and creates a new one. (Likewise, `description`, `namePrefix`, or `vpcId` [cannot be changed](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/working-with-security-groups.html#creating-security-group).) Attempting to recreate the security group leads to a variety of complications depending on how it is used.
   220  //
   221  // Security groups are generally associated with other resources--**more than 100** AWS Provider resources reference security groups. Referencing a resource from another resource creates a one-way dependency. For example, if you create an EC2 `ec2.Instance` that has a `vpcSecurityGroupIds` argument that refers to an `ec2.SecurityGroup` resource, the `ec2.SecurityGroup` is a dependent of the `ec2.Instance`. Because of this, the provider will create the security group first so that it can then be associated with the EC2 instance.
   222  //
   223  // However, the dependency relationship actually goes both directions causing the _Security Group Deletion Problem_. AWS does not allow you to delete the security group associated with another resource (_e.g._, the `ec2.Instance`).
   224  //
   225  // The provider does not model bi-directional dependencies like this, but, even if it did, simply knowing the dependency situation would not be enough to solve it. For example, some resources must always have an associated security group while others don't need to. In addition, when the `ec2.SecurityGroup` resource attempts to recreate, it receives a dependent object error, which does not provide information on whether the dependent object is a security group rule or, for example, an associated EC2 instance. Within the provider, the associated resource (_e.g._, `ec2.Instance`) does not receive an error when the `ec2.SecurityGroup` is trying to recreate even though that is where changes to the associated resource would need to take place (_e.g._, removing the security group association).
   226  //
   227  // Despite these sticky problems, below are some ways to improve your experience when you find it necessary to recreate a security group.
   228  //
   229  // ### Shorter timeout
   230  //
   231  // (This example is one approach to recreating security groups. For more information on the challenges and the _Security Group Deletion Problem_, see the section above.)
   232  //
   233  // If destroying a security group takes a long time, it may be because the provider cannot distinguish between a dependent object (_e.g._, a security group rule or EC2 instance) that is _in the process of being deleted_ and one that is not. In other words, it may be waiting for a train that isn't scheduled to arrive. To fail faster, shorten the `delete` timeout from the default timeout:
   234  //
   235  // <!--Start PulumiCodeChooser -->
   236  // ```go
   237  // package main
   238  //
   239  // import (
   240  //
   241  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   242  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   243  //
   244  // )
   245  //
   246  //	func main() {
   247  //		pulumi.Run(func(ctx *pulumi.Context) error {
   248  //			_, err := ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
   249  //				Name: pulumi.String("izizavle"),
   250  //			})
   251  //			if err != nil {
   252  //				return err
   253  //			}
   254  //			return nil
   255  //		})
   256  //	}
   257  //
   258  // ```
   259  // <!--End PulumiCodeChooser -->
   260  //
   261  // ### Provisioners
   262  //
   263  // (This example is one approach to recreating security groups. For more information on the challenges and the _Security Group Deletion Problem_, see the section above.)
   264  //
   265  // **DISCLAIMER:** We **_HIGHLY_** recommend using one of the above approaches and _NOT_ using local provisioners. Provisioners, like the one shown below, should be considered a **last resort** since they are _not readable_, _require skills outside standard configuration_, are _error prone_ and _difficult to maintain_, are not compatible with cloud environments and upgrade tools, require AWS CLI installation, and are subject to changes outside the AWS Provider.
   266  //
   267  // <!--Start PulumiCodeChooser -->
   268  // ```go
   269  // package main
   270  //
   271  // import (
   272  //
   273  //	"fmt"
   274  //
   275  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
   276  //	"github.com/pulumi/pulumi-command/sdk/v1/go/command/local"
   277  //	"github.com/pulumi/pulumi-null/sdk/v1/go/null"
   278  //	"github.com/pulumi/pulumi-std/sdk/go/std"
   279  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
   280  //
   281  // )
   282  // func main() {
   283  // pulumi.Run(func(ctx *pulumi.Context) error {
   284  // _default, err := ec2.LookupSecurityGroup(ctx, &ec2.LookupSecurityGroupArgs{
   285  // Name: pulumi.StringRef("default"),
   286  // }, nil);
   287  // if err != nil {
   288  // return err
   289  // }
   290  // example, err := ec2.NewSecurityGroup(ctx, "example", &ec2.SecurityGroupArgs{
   291  // Name: pulumi.String("sg"),
   292  // Tags: pulumi.StringMap{
   293  // "workaround1": pulumi.String("tagged-name"),
   294  // "workaround2": pulumi.String(_default.Id),
   295  // },
   296  // })
   297  // if err != nil {
   298  // return err
   299  // }
   300  // _, err = local.NewCommand(ctx, "exampleProvisioner0", &local.CommandArgs{
   301  // Create: "true",
   302  // Update: "true",
   303  // Delete: fmt.Sprintf("            ENDPOINT_ID=`aws ec2 describe-vpc-endpoints --filters \"Name=tag:Name,Values=%v\" --query \"VpcEndpoints[0].VpcEndpointId\" --output text` &&\n            aws ec2 modify-vpc-endpoint --vpc-endpoint-id ${ENDPOINT_ID} --add-security-group-ids %v --remove-security-group-ids %v\n", tags.Workaround1, tags.Workaround2, id),
   304  // }, pulumi.DependsOn([]pulumi.Resource{
   305  // example,
   306  // }))
   307  // if err != nil {
   308  // return err
   309  // }
   310  // exampleResource, err := index.NewResource(ctx, "example", &index.ResourceArgs{
   311  // Triggers: invokeJoin, err := std.Join(ctx, &std.JoinArgs{
   312  // Separator: ",",
   313  // Input: exampleAwsVpcEndpoint.SecurityGroupIds,
   314  // }, nil)
   315  // if err != nil {
   316  // return err
   317  // }
   318  // map[string]interface{}{
   319  // "rerunUponChangeOf": invokeJoin.Result,
   320  // },
   321  // })
   322  // if err != nil {
   323  // return err
   324  // }
   325  // _, err = local.NewCommand(ctx, "exampleResourceProvisioner0", &local.CommandArgs{
   326  // Create: fmt.Sprintf("            aws ec2 modify-vpc-endpoint --vpc-endpoint-id %v --remove-security-group-ids %v\n", exampleAwsVpcEndpoint.Id, _default.Id),
   327  // }, pulumi.DependsOn([]pulumi.Resource{
   328  // exampleResource,
   329  // }))
   330  // if err != nil {
   331  // return err
   332  // }
   333  // return nil
   334  // })
   335  // }
   336  // ```
   337  // <!--End PulumiCodeChooser -->
   338  //
   339  // ## Import
   340  //
   341  // Using `pulumi import`, import Security Groups using the security group `id`. For example:
   342  //
   343  // ```sh
   344  // $ pulumi import aws:ec2/securityGroup:SecurityGroup elb_sg sg-903004f8
   345  // ```
   346  type SecurityGroup struct {
   347  	pulumi.CustomResourceState
   348  
   349  	// ARN of the security group.
   350  	Arn pulumi.StringOutput `pulumi:"arn"`
   351  	// Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   352  	Description pulumi.StringOutput `pulumi:"description"`
   353  	// Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   354  	Egress SecurityGroupEgressArrayOutput `pulumi:"egress"`
   355  	// Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   356  	Ingress SecurityGroupIngressArrayOutput `pulumi:"ingress"`
   357  	// Name of the security group. If omitted, the provider will assign a random, unique name.
   358  	Name pulumi.StringOutput `pulumi:"name"`
   359  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   360  	NamePrefix pulumi.StringOutput `pulumi:"namePrefix"`
   361  	// Owner ID.
   362  	OwnerId pulumi.StringOutput `pulumi:"ownerId"`
   363  	// Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   364  	RevokeRulesOnDelete pulumi.BoolPtrOutput `pulumi:"revokeRulesOnDelete"`
   365  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   366  	Tags pulumi.StringMapOutput `pulumi:"tags"`
   367  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   368  	//
   369  	// Deprecated: Please use `tags` instead.
   370  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
   371  	// VPC ID. Defaults to the region's default VPC.
   372  	VpcId pulumi.StringOutput `pulumi:"vpcId"`
   373  }
   374  
   375  // NewSecurityGroup registers a new resource with the given unique name, arguments, and options.
   376  func NewSecurityGroup(ctx *pulumi.Context,
   377  	name string, args *SecurityGroupArgs, opts ...pulumi.ResourceOption) (*SecurityGroup, error) {
   378  	if args == nil {
   379  		args = &SecurityGroupArgs{}
   380  	}
   381  
   382  	if args.Description == nil {
   383  		args.Description = pulumi.StringPtr("Managed by Pulumi")
   384  	}
   385  	opts = internal.PkgResourceDefaultOpts(opts)
   386  	var resource SecurityGroup
   387  	err := ctx.RegisterResource("aws:ec2/securityGroup:SecurityGroup", name, args, &resource, opts...)
   388  	if err != nil {
   389  		return nil, err
   390  	}
   391  	return &resource, nil
   392  }
   393  
   394  // GetSecurityGroup gets an existing SecurityGroup resource's state with the given name, ID, and optional
   395  // state properties that are used to uniquely qualify the lookup (nil if not required).
   396  func GetSecurityGroup(ctx *pulumi.Context,
   397  	name string, id pulumi.IDInput, state *SecurityGroupState, opts ...pulumi.ResourceOption) (*SecurityGroup, error) {
   398  	var resource SecurityGroup
   399  	err := ctx.ReadResource("aws:ec2/securityGroup:SecurityGroup", name, id, state, &resource, opts...)
   400  	if err != nil {
   401  		return nil, err
   402  	}
   403  	return &resource, nil
   404  }
   405  
   406  // Input properties used for looking up and filtering SecurityGroup resources.
   407  type securityGroupState struct {
   408  	// ARN of the security group.
   409  	Arn *string `pulumi:"arn"`
   410  	// Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   411  	Description *string `pulumi:"description"`
   412  	// Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   413  	Egress []SecurityGroupEgress `pulumi:"egress"`
   414  	// Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   415  	Ingress []SecurityGroupIngress `pulumi:"ingress"`
   416  	// Name of the security group. If omitted, the provider will assign a random, unique name.
   417  	Name *string `pulumi:"name"`
   418  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   419  	NamePrefix *string `pulumi:"namePrefix"`
   420  	// Owner ID.
   421  	OwnerId *string `pulumi:"ownerId"`
   422  	// Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   423  	RevokeRulesOnDelete *bool `pulumi:"revokeRulesOnDelete"`
   424  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   425  	Tags map[string]string `pulumi:"tags"`
   426  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   427  	//
   428  	// Deprecated: Please use `tags` instead.
   429  	TagsAll map[string]string `pulumi:"tagsAll"`
   430  	// VPC ID. Defaults to the region's default VPC.
   431  	VpcId *string `pulumi:"vpcId"`
   432  }
   433  
   434  type SecurityGroupState struct {
   435  	// ARN of the security group.
   436  	Arn pulumi.StringPtrInput
   437  	// Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   438  	Description pulumi.StringPtrInput
   439  	// Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   440  	Egress SecurityGroupEgressArrayInput
   441  	// Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   442  	Ingress SecurityGroupIngressArrayInput
   443  	// Name of the security group. If omitted, the provider will assign a random, unique name.
   444  	Name pulumi.StringPtrInput
   445  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   446  	NamePrefix pulumi.StringPtrInput
   447  	// Owner ID.
   448  	OwnerId pulumi.StringPtrInput
   449  	// Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   450  	RevokeRulesOnDelete pulumi.BoolPtrInput
   451  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   452  	Tags pulumi.StringMapInput
   453  	// A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   454  	//
   455  	// Deprecated: Please use `tags` instead.
   456  	TagsAll pulumi.StringMapInput
   457  	// VPC ID. Defaults to the region's default VPC.
   458  	VpcId pulumi.StringPtrInput
   459  }
   460  
   461  func (SecurityGroupState) ElementType() reflect.Type {
   462  	return reflect.TypeOf((*securityGroupState)(nil)).Elem()
   463  }
   464  
   465  type securityGroupArgs struct {
   466  	// Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   467  	Description *string `pulumi:"description"`
   468  	// Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   469  	Egress []SecurityGroupEgress `pulumi:"egress"`
   470  	// Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   471  	Ingress []SecurityGroupIngress `pulumi:"ingress"`
   472  	// Name of the security group. If omitted, the provider will assign a random, unique name.
   473  	Name *string `pulumi:"name"`
   474  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   475  	NamePrefix *string `pulumi:"namePrefix"`
   476  	// Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   477  	RevokeRulesOnDelete *bool `pulumi:"revokeRulesOnDelete"`
   478  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   479  	Tags map[string]string `pulumi:"tags"`
   480  	// VPC ID. Defaults to the region's default VPC.
   481  	VpcId *string `pulumi:"vpcId"`
   482  }
   483  
   484  // The set of arguments for constructing a SecurityGroup resource.
   485  type SecurityGroupArgs struct {
   486  	// Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   487  	Description pulumi.StringPtrInput
   488  	// Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   489  	Egress SecurityGroupEgressArrayInput
   490  	// Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   491  	Ingress SecurityGroupIngressArrayInput
   492  	// Name of the security group. If omitted, the provider will assign a random, unique name.
   493  	Name pulumi.StringPtrInput
   494  	// Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   495  	NamePrefix pulumi.StringPtrInput
   496  	// Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   497  	RevokeRulesOnDelete pulumi.BoolPtrInput
   498  	// Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   499  	Tags pulumi.StringMapInput
   500  	// VPC ID. Defaults to the region's default VPC.
   501  	VpcId pulumi.StringPtrInput
   502  }
   503  
   504  func (SecurityGroupArgs) ElementType() reflect.Type {
   505  	return reflect.TypeOf((*securityGroupArgs)(nil)).Elem()
   506  }
   507  
   508  type SecurityGroupInput interface {
   509  	pulumi.Input
   510  
   511  	ToSecurityGroupOutput() SecurityGroupOutput
   512  	ToSecurityGroupOutputWithContext(ctx context.Context) SecurityGroupOutput
   513  }
   514  
   515  func (*SecurityGroup) ElementType() reflect.Type {
   516  	return reflect.TypeOf((**SecurityGroup)(nil)).Elem()
   517  }
   518  
   519  func (i *SecurityGroup) ToSecurityGroupOutput() SecurityGroupOutput {
   520  	return i.ToSecurityGroupOutputWithContext(context.Background())
   521  }
   522  
   523  func (i *SecurityGroup) ToSecurityGroupOutputWithContext(ctx context.Context) SecurityGroupOutput {
   524  	return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupOutput)
   525  }
   526  
   527  // SecurityGroupArrayInput is an input type that accepts SecurityGroupArray and SecurityGroupArrayOutput values.
   528  // You can construct a concrete instance of `SecurityGroupArrayInput` via:
   529  //
   530  //	SecurityGroupArray{ SecurityGroupArgs{...} }
   531  type SecurityGroupArrayInput interface {
   532  	pulumi.Input
   533  
   534  	ToSecurityGroupArrayOutput() SecurityGroupArrayOutput
   535  	ToSecurityGroupArrayOutputWithContext(context.Context) SecurityGroupArrayOutput
   536  }
   537  
   538  type SecurityGroupArray []SecurityGroupInput
   539  
   540  func (SecurityGroupArray) ElementType() reflect.Type {
   541  	return reflect.TypeOf((*[]*SecurityGroup)(nil)).Elem()
   542  }
   543  
   544  func (i SecurityGroupArray) ToSecurityGroupArrayOutput() SecurityGroupArrayOutput {
   545  	return i.ToSecurityGroupArrayOutputWithContext(context.Background())
   546  }
   547  
   548  func (i SecurityGroupArray) ToSecurityGroupArrayOutputWithContext(ctx context.Context) SecurityGroupArrayOutput {
   549  	return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupArrayOutput)
   550  }
   551  
   552  // SecurityGroupMapInput is an input type that accepts SecurityGroupMap and SecurityGroupMapOutput values.
   553  // You can construct a concrete instance of `SecurityGroupMapInput` via:
   554  //
   555  //	SecurityGroupMap{ "key": SecurityGroupArgs{...} }
   556  type SecurityGroupMapInput interface {
   557  	pulumi.Input
   558  
   559  	ToSecurityGroupMapOutput() SecurityGroupMapOutput
   560  	ToSecurityGroupMapOutputWithContext(context.Context) SecurityGroupMapOutput
   561  }
   562  
   563  type SecurityGroupMap map[string]SecurityGroupInput
   564  
   565  func (SecurityGroupMap) ElementType() reflect.Type {
   566  	return reflect.TypeOf((*map[string]*SecurityGroup)(nil)).Elem()
   567  }
   568  
   569  func (i SecurityGroupMap) ToSecurityGroupMapOutput() SecurityGroupMapOutput {
   570  	return i.ToSecurityGroupMapOutputWithContext(context.Background())
   571  }
   572  
   573  func (i SecurityGroupMap) ToSecurityGroupMapOutputWithContext(ctx context.Context) SecurityGroupMapOutput {
   574  	return pulumi.ToOutputWithContext(ctx, i).(SecurityGroupMapOutput)
   575  }
   576  
   577  type SecurityGroupOutput struct{ *pulumi.OutputState }
   578  
   579  func (SecurityGroupOutput) ElementType() reflect.Type {
   580  	return reflect.TypeOf((**SecurityGroup)(nil)).Elem()
   581  }
   582  
   583  func (o SecurityGroupOutput) ToSecurityGroupOutput() SecurityGroupOutput {
   584  	return o
   585  }
   586  
   587  func (o SecurityGroupOutput) ToSecurityGroupOutputWithContext(ctx context.Context) SecurityGroupOutput {
   588  	return o
   589  }
   590  
   591  // ARN of the security group.
   592  func (o SecurityGroupOutput) Arn() pulumi.StringOutput {
   593  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   594  }
   595  
   596  // Security group description. Defaults to `Managed by Pulumi`. Cannot be `""`. **NOTE**: This field maps to the AWS `GroupDescription` attribute, for which there is no Update API. If you'd like to classify your security groups in a way that can be updated, use `tags`.
   597  func (o SecurityGroupOutput) Description() pulumi.StringOutput {
   598  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.Description }).(pulumi.StringOutput)
   599  }
   600  
   601  // Configuration block for egress rules. Can be specified multiple times for each egress rule. Each egress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   602  func (o SecurityGroupOutput) Egress() SecurityGroupEgressArrayOutput {
   603  	return o.ApplyT(func(v *SecurityGroup) SecurityGroupEgressArrayOutput { return v.Egress }).(SecurityGroupEgressArrayOutput)
   604  }
   605  
   606  // Configuration block for ingress rules. Can be specified multiple times for each ingress rule. Each ingress block supports fields documented below. This argument is processed in attribute-as-blocks mode.
   607  func (o SecurityGroupOutput) Ingress() SecurityGroupIngressArrayOutput {
   608  	return o.ApplyT(func(v *SecurityGroup) SecurityGroupIngressArrayOutput { return v.Ingress }).(SecurityGroupIngressArrayOutput)
   609  }
   610  
   611  // Name of the security group. If omitted, the provider will assign a random, unique name.
   612  func (o SecurityGroupOutput) Name() pulumi.StringOutput {
   613  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.Name }).(pulumi.StringOutput)
   614  }
   615  
   616  // Creates a unique name beginning with the specified prefix. Conflicts with `name`.
   617  func (o SecurityGroupOutput) NamePrefix() pulumi.StringOutput {
   618  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.NamePrefix }).(pulumi.StringOutput)
   619  }
   620  
   621  // Owner ID.
   622  func (o SecurityGroupOutput) OwnerId() pulumi.StringOutput {
   623  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.OwnerId }).(pulumi.StringOutput)
   624  }
   625  
   626  // Instruct the provider to revoke all of the Security Groups attached ingress and egress rules before deleting the rule itself. This is normally not needed, however certain AWS services such as Elastic Map Reduce may automatically add required rules to security groups used with the service, and those rules may contain a cyclic dependency that prevent the security groups from being destroyed without removing the dependency first. Default `false`.
   627  func (o SecurityGroupOutput) RevokeRulesOnDelete() pulumi.BoolPtrOutput {
   628  	return o.ApplyT(func(v *SecurityGroup) pulumi.BoolPtrOutput { return v.RevokeRulesOnDelete }).(pulumi.BoolPtrOutput)
   629  }
   630  
   631  // Map of tags to assign to the resource. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   632  func (o SecurityGroupOutput) Tags() pulumi.StringMapOutput {
   633  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   634  }
   635  
   636  // A map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   637  //
   638  // Deprecated: Please use `tags` instead.
   639  func (o SecurityGroupOutput) TagsAll() pulumi.StringMapOutput {
   640  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   641  }
   642  
   643  // VPC ID. Defaults to the region's default VPC.
   644  func (o SecurityGroupOutput) VpcId() pulumi.StringOutput {
   645  	return o.ApplyT(func(v *SecurityGroup) pulumi.StringOutput { return v.VpcId }).(pulumi.StringOutput)
   646  }
   647  
   648  type SecurityGroupArrayOutput struct{ *pulumi.OutputState }
   649  
   650  func (SecurityGroupArrayOutput) ElementType() reflect.Type {
   651  	return reflect.TypeOf((*[]*SecurityGroup)(nil)).Elem()
   652  }
   653  
   654  func (o SecurityGroupArrayOutput) ToSecurityGroupArrayOutput() SecurityGroupArrayOutput {
   655  	return o
   656  }
   657  
   658  func (o SecurityGroupArrayOutput) ToSecurityGroupArrayOutputWithContext(ctx context.Context) SecurityGroupArrayOutput {
   659  	return o
   660  }
   661  
   662  func (o SecurityGroupArrayOutput) Index(i pulumi.IntInput) SecurityGroupOutput {
   663  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *SecurityGroup {
   664  		return vs[0].([]*SecurityGroup)[vs[1].(int)]
   665  	}).(SecurityGroupOutput)
   666  }
   667  
   668  type SecurityGroupMapOutput struct{ *pulumi.OutputState }
   669  
   670  func (SecurityGroupMapOutput) ElementType() reflect.Type {
   671  	return reflect.TypeOf((*map[string]*SecurityGroup)(nil)).Elem()
   672  }
   673  
   674  func (o SecurityGroupMapOutput) ToSecurityGroupMapOutput() SecurityGroupMapOutput {
   675  	return o
   676  }
   677  
   678  func (o SecurityGroupMapOutput) ToSecurityGroupMapOutputWithContext(ctx context.Context) SecurityGroupMapOutput {
   679  	return o
   680  }
   681  
   682  func (o SecurityGroupMapOutput) MapIndex(k pulumi.StringInput) SecurityGroupOutput {
   683  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *SecurityGroup {
   684  		return vs[0].(map[string]*SecurityGroup)[vs[1].(string)]
   685  	}).(SecurityGroupOutput)
   686  }
   687  
   688  func init() {
   689  	pulumi.RegisterInputType(reflect.TypeOf((*SecurityGroupInput)(nil)).Elem(), &SecurityGroup{})
   690  	pulumi.RegisterInputType(reflect.TypeOf((*SecurityGroupArrayInput)(nil)).Elem(), SecurityGroupArray{})
   691  	pulumi.RegisterInputType(reflect.TypeOf((*SecurityGroupMapInput)(nil)).Elem(), SecurityGroupMap{})
   692  	pulumi.RegisterOutputType(SecurityGroupOutput{})
   693  	pulumi.RegisterOutputType(SecurityGroupArrayOutput{})
   694  	pulumi.RegisterOutputType(SecurityGroupMapOutput{})
   695  }