github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/apprunner/vpcConnector.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 apprunner
     5  
     6  import (
     7  	"context"
     8  	"reflect"
     9  
    10  	"errors"
    11  	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal"
    12  	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    13  )
    14  
    15  // Manages an App Runner VPC Connector.
    16  //
    17  // ## Example Usage
    18  //
    19  // <!--Start PulumiCodeChooser -->
    20  // ```go
    21  // package main
    22  //
    23  // import (
    24  //
    25  //	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/apprunner"
    26  //	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    27  //
    28  // )
    29  //
    30  //	func main() {
    31  //		pulumi.Run(func(ctx *pulumi.Context) error {
    32  //			_, err := apprunner.NewVpcConnector(ctx, "connector", &apprunner.VpcConnectorArgs{
    33  //				VpcConnectorName: pulumi.String("name"),
    34  //				Subnets: pulumi.StringArray{
    35  //					pulumi.String("subnet1"),
    36  //					pulumi.String("subnet2"),
    37  //				},
    38  //				SecurityGroups: pulumi.StringArray{
    39  //					pulumi.String("sg1"),
    40  //					pulumi.String("sg2"),
    41  //				},
    42  //			})
    43  //			if err != nil {
    44  //				return err
    45  //			}
    46  //			return nil
    47  //		})
    48  //	}
    49  //
    50  // ```
    51  // <!--End PulumiCodeChooser -->
    52  //
    53  // ## Import
    54  //
    55  // Using `pulumi import`, import App Runner vpc connector using the `arn`. For example:
    56  //
    57  // ```sh
    58  // $ pulumi import aws:apprunner/vpcConnector:VpcConnector example arn:aws:apprunner:us-east-1:1234567890:vpcconnector/example/1/0a03292a89764e5882c41d8f991c82fe
    59  // ```
    60  type VpcConnector struct {
    61  	pulumi.CustomResourceState
    62  
    63  	// ARN of VPC connector.
    64  	Arn pulumi.StringOutput `pulumi:"arn"`
    65  	// List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
    66  	SecurityGroups pulumi.StringArrayOutput `pulumi:"securityGroups"`
    67  	// Current state of the VPC connector. If the status of a connector revision is INACTIVE, it was deleted and can't be used. Inactive connector revisions are permanently removed some time after they are deleted.
    68  	Status pulumi.StringOutput `pulumi:"status"`
    69  	// List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
    70  	Subnets pulumi.StringArrayOutput `pulumi:"subnets"`
    71  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
    72  	Tags pulumi.StringMapOutput `pulumi:"tags"`
    73  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
    74  	//
    75  	// Deprecated: Please use `tags` instead.
    76  	TagsAll pulumi.StringMapOutput `pulumi:"tagsAll"`
    77  	// Name for the VPC connector.
    78  	VpcConnectorName pulumi.StringOutput `pulumi:"vpcConnectorName"`
    79  	// The revision of VPC connector. It's unique among all the active connectors ("Status": "ACTIVE") that share the same Name.
    80  	VpcConnectorRevision pulumi.IntOutput `pulumi:"vpcConnectorRevision"`
    81  }
    82  
    83  // NewVpcConnector registers a new resource with the given unique name, arguments, and options.
    84  func NewVpcConnector(ctx *pulumi.Context,
    85  	name string, args *VpcConnectorArgs, opts ...pulumi.ResourceOption) (*VpcConnector, error) {
    86  	if args == nil {
    87  		return nil, errors.New("missing one or more required arguments")
    88  	}
    89  
    90  	if args.SecurityGroups == nil {
    91  		return nil, errors.New("invalid value for required argument 'SecurityGroups'")
    92  	}
    93  	if args.Subnets == nil {
    94  		return nil, errors.New("invalid value for required argument 'Subnets'")
    95  	}
    96  	if args.VpcConnectorName == nil {
    97  		return nil, errors.New("invalid value for required argument 'VpcConnectorName'")
    98  	}
    99  	opts = internal.PkgResourceDefaultOpts(opts)
   100  	var resource VpcConnector
   101  	err := ctx.RegisterResource("aws:apprunner/vpcConnector:VpcConnector", name, args, &resource, opts...)
   102  	if err != nil {
   103  		return nil, err
   104  	}
   105  	return &resource, nil
   106  }
   107  
   108  // GetVpcConnector gets an existing VpcConnector resource's state with the given name, ID, and optional
   109  // state properties that are used to uniquely qualify the lookup (nil if not required).
   110  func GetVpcConnector(ctx *pulumi.Context,
   111  	name string, id pulumi.IDInput, state *VpcConnectorState, opts ...pulumi.ResourceOption) (*VpcConnector, error) {
   112  	var resource VpcConnector
   113  	err := ctx.ReadResource("aws:apprunner/vpcConnector:VpcConnector", name, id, state, &resource, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	return &resource, nil
   118  }
   119  
   120  // Input properties used for looking up and filtering VpcConnector resources.
   121  type vpcConnectorState struct {
   122  	// ARN of VPC connector.
   123  	Arn *string `pulumi:"arn"`
   124  	// List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
   125  	SecurityGroups []string `pulumi:"securityGroups"`
   126  	// Current state of the VPC connector. If the status of a connector revision is INACTIVE, it was deleted and can't be used. Inactive connector revisions are permanently removed some time after they are deleted.
   127  	Status *string `pulumi:"status"`
   128  	// List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
   129  	Subnets []string `pulumi:"subnets"`
   130  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   131  	Tags map[string]string `pulumi:"tags"`
   132  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   133  	//
   134  	// Deprecated: Please use `tags` instead.
   135  	TagsAll map[string]string `pulumi:"tagsAll"`
   136  	// Name for the VPC connector.
   137  	VpcConnectorName *string `pulumi:"vpcConnectorName"`
   138  	// The revision of VPC connector. It's unique among all the active connectors ("Status": "ACTIVE") that share the same Name.
   139  	VpcConnectorRevision *int `pulumi:"vpcConnectorRevision"`
   140  }
   141  
   142  type VpcConnectorState struct {
   143  	// ARN of VPC connector.
   144  	Arn pulumi.StringPtrInput
   145  	// List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
   146  	SecurityGroups pulumi.StringArrayInput
   147  	// Current state of the VPC connector. If the status of a connector revision is INACTIVE, it was deleted and can't be used. Inactive connector revisions are permanently removed some time after they are deleted.
   148  	Status pulumi.StringPtrInput
   149  	// List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
   150  	Subnets pulumi.StringArrayInput
   151  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   152  	Tags pulumi.StringMapInput
   153  	// Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   154  	//
   155  	// Deprecated: Please use `tags` instead.
   156  	TagsAll pulumi.StringMapInput
   157  	// Name for the VPC connector.
   158  	VpcConnectorName pulumi.StringPtrInput
   159  	// The revision of VPC connector. It's unique among all the active connectors ("Status": "ACTIVE") that share the same Name.
   160  	VpcConnectorRevision pulumi.IntPtrInput
   161  }
   162  
   163  func (VpcConnectorState) ElementType() reflect.Type {
   164  	return reflect.TypeOf((*vpcConnectorState)(nil)).Elem()
   165  }
   166  
   167  type vpcConnectorArgs struct {
   168  	// List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
   169  	SecurityGroups []string `pulumi:"securityGroups"`
   170  	// List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
   171  	Subnets []string `pulumi:"subnets"`
   172  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   173  	Tags map[string]string `pulumi:"tags"`
   174  	// Name for the VPC connector.
   175  	VpcConnectorName string `pulumi:"vpcConnectorName"`
   176  }
   177  
   178  // The set of arguments for constructing a VpcConnector resource.
   179  type VpcConnectorArgs struct {
   180  	// List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
   181  	SecurityGroups pulumi.StringArrayInput
   182  	// List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
   183  	Subnets pulumi.StringArrayInput
   184  	// Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   185  	Tags pulumi.StringMapInput
   186  	// Name for the VPC connector.
   187  	VpcConnectorName pulumi.StringInput
   188  }
   189  
   190  func (VpcConnectorArgs) ElementType() reflect.Type {
   191  	return reflect.TypeOf((*vpcConnectorArgs)(nil)).Elem()
   192  }
   193  
   194  type VpcConnectorInput interface {
   195  	pulumi.Input
   196  
   197  	ToVpcConnectorOutput() VpcConnectorOutput
   198  	ToVpcConnectorOutputWithContext(ctx context.Context) VpcConnectorOutput
   199  }
   200  
   201  func (*VpcConnector) ElementType() reflect.Type {
   202  	return reflect.TypeOf((**VpcConnector)(nil)).Elem()
   203  }
   204  
   205  func (i *VpcConnector) ToVpcConnectorOutput() VpcConnectorOutput {
   206  	return i.ToVpcConnectorOutputWithContext(context.Background())
   207  }
   208  
   209  func (i *VpcConnector) ToVpcConnectorOutputWithContext(ctx context.Context) VpcConnectorOutput {
   210  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectorOutput)
   211  }
   212  
   213  // VpcConnectorArrayInput is an input type that accepts VpcConnectorArray and VpcConnectorArrayOutput values.
   214  // You can construct a concrete instance of `VpcConnectorArrayInput` via:
   215  //
   216  //	VpcConnectorArray{ VpcConnectorArgs{...} }
   217  type VpcConnectorArrayInput interface {
   218  	pulumi.Input
   219  
   220  	ToVpcConnectorArrayOutput() VpcConnectorArrayOutput
   221  	ToVpcConnectorArrayOutputWithContext(context.Context) VpcConnectorArrayOutput
   222  }
   223  
   224  type VpcConnectorArray []VpcConnectorInput
   225  
   226  func (VpcConnectorArray) ElementType() reflect.Type {
   227  	return reflect.TypeOf((*[]*VpcConnector)(nil)).Elem()
   228  }
   229  
   230  func (i VpcConnectorArray) ToVpcConnectorArrayOutput() VpcConnectorArrayOutput {
   231  	return i.ToVpcConnectorArrayOutputWithContext(context.Background())
   232  }
   233  
   234  func (i VpcConnectorArray) ToVpcConnectorArrayOutputWithContext(ctx context.Context) VpcConnectorArrayOutput {
   235  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectorArrayOutput)
   236  }
   237  
   238  // VpcConnectorMapInput is an input type that accepts VpcConnectorMap and VpcConnectorMapOutput values.
   239  // You can construct a concrete instance of `VpcConnectorMapInput` via:
   240  //
   241  //	VpcConnectorMap{ "key": VpcConnectorArgs{...} }
   242  type VpcConnectorMapInput interface {
   243  	pulumi.Input
   244  
   245  	ToVpcConnectorMapOutput() VpcConnectorMapOutput
   246  	ToVpcConnectorMapOutputWithContext(context.Context) VpcConnectorMapOutput
   247  }
   248  
   249  type VpcConnectorMap map[string]VpcConnectorInput
   250  
   251  func (VpcConnectorMap) ElementType() reflect.Type {
   252  	return reflect.TypeOf((*map[string]*VpcConnector)(nil)).Elem()
   253  }
   254  
   255  func (i VpcConnectorMap) ToVpcConnectorMapOutput() VpcConnectorMapOutput {
   256  	return i.ToVpcConnectorMapOutputWithContext(context.Background())
   257  }
   258  
   259  func (i VpcConnectorMap) ToVpcConnectorMapOutputWithContext(ctx context.Context) VpcConnectorMapOutput {
   260  	return pulumi.ToOutputWithContext(ctx, i).(VpcConnectorMapOutput)
   261  }
   262  
   263  type VpcConnectorOutput struct{ *pulumi.OutputState }
   264  
   265  func (VpcConnectorOutput) ElementType() reflect.Type {
   266  	return reflect.TypeOf((**VpcConnector)(nil)).Elem()
   267  }
   268  
   269  func (o VpcConnectorOutput) ToVpcConnectorOutput() VpcConnectorOutput {
   270  	return o
   271  }
   272  
   273  func (o VpcConnectorOutput) ToVpcConnectorOutputWithContext(ctx context.Context) VpcConnectorOutput {
   274  	return o
   275  }
   276  
   277  // ARN of VPC connector.
   278  func (o VpcConnectorOutput) Arn() pulumi.StringOutput {
   279  	return o.ApplyT(func(v *VpcConnector) pulumi.StringOutput { return v.Arn }).(pulumi.StringOutput)
   280  }
   281  
   282  // List of IDs of security groups that App Runner should use for access to AWS resources under the specified subnets. If not specified, App Runner uses the default security group of the Amazon VPC. The default security group allows all outbound traffic.
   283  func (o VpcConnectorOutput) SecurityGroups() pulumi.StringArrayOutput {
   284  	return o.ApplyT(func(v *VpcConnector) pulumi.StringArrayOutput { return v.SecurityGroups }).(pulumi.StringArrayOutput)
   285  }
   286  
   287  // Current state of the VPC connector. If the status of a connector revision is INACTIVE, it was deleted and can't be used. Inactive connector revisions are permanently removed some time after they are deleted.
   288  func (o VpcConnectorOutput) Status() pulumi.StringOutput {
   289  	return o.ApplyT(func(v *VpcConnector) pulumi.StringOutput { return v.Status }).(pulumi.StringOutput)
   290  }
   291  
   292  // List of IDs of subnets that App Runner should use when it associates your service with a custom Amazon VPC. Specify IDs of subnets of a single Amazon VPC. App Runner determines the Amazon VPC from the subnets you specify.
   293  func (o VpcConnectorOutput) Subnets() pulumi.StringArrayOutput {
   294  	return o.ApplyT(func(v *VpcConnector) pulumi.StringArrayOutput { return v.Subnets }).(pulumi.StringArrayOutput)
   295  }
   296  
   297  // Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
   298  func (o VpcConnectorOutput) Tags() pulumi.StringMapOutput {
   299  	return o.ApplyT(func(v *VpcConnector) pulumi.StringMapOutput { return v.Tags }).(pulumi.StringMapOutput)
   300  }
   301  
   302  // Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
   303  //
   304  // Deprecated: Please use `tags` instead.
   305  func (o VpcConnectorOutput) TagsAll() pulumi.StringMapOutput {
   306  	return o.ApplyT(func(v *VpcConnector) pulumi.StringMapOutput { return v.TagsAll }).(pulumi.StringMapOutput)
   307  }
   308  
   309  // Name for the VPC connector.
   310  func (o VpcConnectorOutput) VpcConnectorName() pulumi.StringOutput {
   311  	return o.ApplyT(func(v *VpcConnector) pulumi.StringOutput { return v.VpcConnectorName }).(pulumi.StringOutput)
   312  }
   313  
   314  // The revision of VPC connector. It's unique among all the active connectors ("Status": "ACTIVE") that share the same Name.
   315  func (o VpcConnectorOutput) VpcConnectorRevision() pulumi.IntOutput {
   316  	return o.ApplyT(func(v *VpcConnector) pulumi.IntOutput { return v.VpcConnectorRevision }).(pulumi.IntOutput)
   317  }
   318  
   319  type VpcConnectorArrayOutput struct{ *pulumi.OutputState }
   320  
   321  func (VpcConnectorArrayOutput) ElementType() reflect.Type {
   322  	return reflect.TypeOf((*[]*VpcConnector)(nil)).Elem()
   323  }
   324  
   325  func (o VpcConnectorArrayOutput) ToVpcConnectorArrayOutput() VpcConnectorArrayOutput {
   326  	return o
   327  }
   328  
   329  func (o VpcConnectorArrayOutput) ToVpcConnectorArrayOutputWithContext(ctx context.Context) VpcConnectorArrayOutput {
   330  	return o
   331  }
   332  
   333  func (o VpcConnectorArrayOutput) Index(i pulumi.IntInput) VpcConnectorOutput {
   334  	return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcConnector {
   335  		return vs[0].([]*VpcConnector)[vs[1].(int)]
   336  	}).(VpcConnectorOutput)
   337  }
   338  
   339  type VpcConnectorMapOutput struct{ *pulumi.OutputState }
   340  
   341  func (VpcConnectorMapOutput) ElementType() reflect.Type {
   342  	return reflect.TypeOf((*map[string]*VpcConnector)(nil)).Elem()
   343  }
   344  
   345  func (o VpcConnectorMapOutput) ToVpcConnectorMapOutput() VpcConnectorMapOutput {
   346  	return o
   347  }
   348  
   349  func (o VpcConnectorMapOutput) ToVpcConnectorMapOutputWithContext(ctx context.Context) VpcConnectorMapOutput {
   350  	return o
   351  }
   352  
   353  func (o VpcConnectorMapOutput) MapIndex(k pulumi.StringInput) VpcConnectorOutput {
   354  	return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcConnector {
   355  		return vs[0].(map[string]*VpcConnector)[vs[1].(string)]
   356  	}).(VpcConnectorOutput)
   357  }
   358  
   359  func init() {
   360  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectorInput)(nil)).Elem(), &VpcConnector{})
   361  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectorArrayInput)(nil)).Elem(), VpcConnectorArray{})
   362  	pulumi.RegisterInputType(reflect.TypeOf((*VpcConnectorMapInput)(nil)).Elem(), VpcConnectorMap{})
   363  	pulumi.RegisterOutputType(VpcConnectorOutput{})
   364  	pulumi.RegisterOutputType(VpcConnectorArrayOutput{})
   365  	pulumi.RegisterOutputType(VpcConnectorMapOutput{})
   366  }