github.com/pulumi/pulumi-aws/sdk/v6@v6.32.0/go/aws/ec2/vpcEndpointSubnetAssociation.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 "errors" 11 "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/internal" 12 "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 13 ) 14 15 // Provides a resource to create an association between a VPC endpoint and a subnet. 16 // 17 // > **NOTE on VPC Endpoints and VPC Endpoint Subnet Associations:** This provider provides 18 // both a standalone VPC Endpoint Subnet Association (an association between a VPC endpoint 19 // and a single `subnetId`) and a VPC Endpoint resource with a `subnetIds` 20 // attribute. Do not use the same subnet ID in both a VPC Endpoint resource and a VPC Endpoint Subnet 21 // Association resource. Doing so will cause a conflict of associations and will overwrite the association. 22 // 23 // ## Example Usage 24 // 25 // Basic usage: 26 // 27 // <!--Start PulumiCodeChooser --> 28 // ```go 29 // package main 30 // 31 // import ( 32 // 33 // "github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2" 34 // "github.com/pulumi/pulumi/sdk/v3/go/pulumi" 35 // 36 // ) 37 // 38 // func main() { 39 // pulumi.Run(func(ctx *pulumi.Context) error { 40 // _, err := ec2.NewVpcEndpointSubnetAssociation(ctx, "sn_ec2", &ec2.VpcEndpointSubnetAssociationArgs{ 41 // VpcEndpointId: pulumi.Any(ec2.Id), 42 // SubnetId: pulumi.Any(sn.Id), 43 // }) 44 // if err != nil { 45 // return err 46 // } 47 // return nil 48 // }) 49 // } 50 // 51 // ``` 52 // <!--End PulumiCodeChooser --> 53 // 54 // ## Import 55 // 56 // Using `pulumi import`, import VPC Endpoint Subnet Associations using `vpc_endpoint_id` together with `subnet_id`. For example: 57 // 58 // ```sh 59 // $ pulumi import aws:ec2/vpcEndpointSubnetAssociation:VpcEndpointSubnetAssociation example vpce-aaaaaaaa/subnet-bbbbbbbbbbbbbbbbb 60 // ``` 61 type VpcEndpointSubnetAssociation struct { 62 pulumi.CustomResourceState 63 64 // The ID of the subnet to be associated with the VPC endpoint. 65 SubnetId pulumi.StringOutput `pulumi:"subnetId"` 66 // The ID of the VPC endpoint with which the subnet will be associated. 67 VpcEndpointId pulumi.StringOutput `pulumi:"vpcEndpointId"` 68 } 69 70 // NewVpcEndpointSubnetAssociation registers a new resource with the given unique name, arguments, and options. 71 func NewVpcEndpointSubnetAssociation(ctx *pulumi.Context, 72 name string, args *VpcEndpointSubnetAssociationArgs, opts ...pulumi.ResourceOption) (*VpcEndpointSubnetAssociation, error) { 73 if args == nil { 74 return nil, errors.New("missing one or more required arguments") 75 } 76 77 if args.SubnetId == nil { 78 return nil, errors.New("invalid value for required argument 'SubnetId'") 79 } 80 if args.VpcEndpointId == nil { 81 return nil, errors.New("invalid value for required argument 'VpcEndpointId'") 82 } 83 opts = internal.PkgResourceDefaultOpts(opts) 84 var resource VpcEndpointSubnetAssociation 85 err := ctx.RegisterResource("aws:ec2/vpcEndpointSubnetAssociation:VpcEndpointSubnetAssociation", name, args, &resource, opts...) 86 if err != nil { 87 return nil, err 88 } 89 return &resource, nil 90 } 91 92 // GetVpcEndpointSubnetAssociation gets an existing VpcEndpointSubnetAssociation resource's state with the given name, ID, and optional 93 // state properties that are used to uniquely qualify the lookup (nil if not required). 94 func GetVpcEndpointSubnetAssociation(ctx *pulumi.Context, 95 name string, id pulumi.IDInput, state *VpcEndpointSubnetAssociationState, opts ...pulumi.ResourceOption) (*VpcEndpointSubnetAssociation, error) { 96 var resource VpcEndpointSubnetAssociation 97 err := ctx.ReadResource("aws:ec2/vpcEndpointSubnetAssociation:VpcEndpointSubnetAssociation", name, id, state, &resource, opts...) 98 if err != nil { 99 return nil, err 100 } 101 return &resource, nil 102 } 103 104 // Input properties used for looking up and filtering VpcEndpointSubnetAssociation resources. 105 type vpcEndpointSubnetAssociationState struct { 106 // The ID of the subnet to be associated with the VPC endpoint. 107 SubnetId *string `pulumi:"subnetId"` 108 // The ID of the VPC endpoint with which the subnet will be associated. 109 VpcEndpointId *string `pulumi:"vpcEndpointId"` 110 } 111 112 type VpcEndpointSubnetAssociationState struct { 113 // The ID of the subnet to be associated with the VPC endpoint. 114 SubnetId pulumi.StringPtrInput 115 // The ID of the VPC endpoint with which the subnet will be associated. 116 VpcEndpointId pulumi.StringPtrInput 117 } 118 119 func (VpcEndpointSubnetAssociationState) ElementType() reflect.Type { 120 return reflect.TypeOf((*vpcEndpointSubnetAssociationState)(nil)).Elem() 121 } 122 123 type vpcEndpointSubnetAssociationArgs struct { 124 // The ID of the subnet to be associated with the VPC endpoint. 125 SubnetId string `pulumi:"subnetId"` 126 // The ID of the VPC endpoint with which the subnet will be associated. 127 VpcEndpointId string `pulumi:"vpcEndpointId"` 128 } 129 130 // The set of arguments for constructing a VpcEndpointSubnetAssociation resource. 131 type VpcEndpointSubnetAssociationArgs struct { 132 // The ID of the subnet to be associated with the VPC endpoint. 133 SubnetId pulumi.StringInput 134 // The ID of the VPC endpoint with which the subnet will be associated. 135 VpcEndpointId pulumi.StringInput 136 } 137 138 func (VpcEndpointSubnetAssociationArgs) ElementType() reflect.Type { 139 return reflect.TypeOf((*vpcEndpointSubnetAssociationArgs)(nil)).Elem() 140 } 141 142 type VpcEndpointSubnetAssociationInput interface { 143 pulumi.Input 144 145 ToVpcEndpointSubnetAssociationOutput() VpcEndpointSubnetAssociationOutput 146 ToVpcEndpointSubnetAssociationOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationOutput 147 } 148 149 func (*VpcEndpointSubnetAssociation) ElementType() reflect.Type { 150 return reflect.TypeOf((**VpcEndpointSubnetAssociation)(nil)).Elem() 151 } 152 153 func (i *VpcEndpointSubnetAssociation) ToVpcEndpointSubnetAssociationOutput() VpcEndpointSubnetAssociationOutput { 154 return i.ToVpcEndpointSubnetAssociationOutputWithContext(context.Background()) 155 } 156 157 func (i *VpcEndpointSubnetAssociation) ToVpcEndpointSubnetAssociationOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationOutput { 158 return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointSubnetAssociationOutput) 159 } 160 161 // VpcEndpointSubnetAssociationArrayInput is an input type that accepts VpcEndpointSubnetAssociationArray and VpcEndpointSubnetAssociationArrayOutput values. 162 // You can construct a concrete instance of `VpcEndpointSubnetAssociationArrayInput` via: 163 // 164 // VpcEndpointSubnetAssociationArray{ VpcEndpointSubnetAssociationArgs{...} } 165 type VpcEndpointSubnetAssociationArrayInput interface { 166 pulumi.Input 167 168 ToVpcEndpointSubnetAssociationArrayOutput() VpcEndpointSubnetAssociationArrayOutput 169 ToVpcEndpointSubnetAssociationArrayOutputWithContext(context.Context) VpcEndpointSubnetAssociationArrayOutput 170 } 171 172 type VpcEndpointSubnetAssociationArray []VpcEndpointSubnetAssociationInput 173 174 func (VpcEndpointSubnetAssociationArray) ElementType() reflect.Type { 175 return reflect.TypeOf((*[]*VpcEndpointSubnetAssociation)(nil)).Elem() 176 } 177 178 func (i VpcEndpointSubnetAssociationArray) ToVpcEndpointSubnetAssociationArrayOutput() VpcEndpointSubnetAssociationArrayOutput { 179 return i.ToVpcEndpointSubnetAssociationArrayOutputWithContext(context.Background()) 180 } 181 182 func (i VpcEndpointSubnetAssociationArray) ToVpcEndpointSubnetAssociationArrayOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationArrayOutput { 183 return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointSubnetAssociationArrayOutput) 184 } 185 186 // VpcEndpointSubnetAssociationMapInput is an input type that accepts VpcEndpointSubnetAssociationMap and VpcEndpointSubnetAssociationMapOutput values. 187 // You can construct a concrete instance of `VpcEndpointSubnetAssociationMapInput` via: 188 // 189 // VpcEndpointSubnetAssociationMap{ "key": VpcEndpointSubnetAssociationArgs{...} } 190 type VpcEndpointSubnetAssociationMapInput interface { 191 pulumi.Input 192 193 ToVpcEndpointSubnetAssociationMapOutput() VpcEndpointSubnetAssociationMapOutput 194 ToVpcEndpointSubnetAssociationMapOutputWithContext(context.Context) VpcEndpointSubnetAssociationMapOutput 195 } 196 197 type VpcEndpointSubnetAssociationMap map[string]VpcEndpointSubnetAssociationInput 198 199 func (VpcEndpointSubnetAssociationMap) ElementType() reflect.Type { 200 return reflect.TypeOf((*map[string]*VpcEndpointSubnetAssociation)(nil)).Elem() 201 } 202 203 func (i VpcEndpointSubnetAssociationMap) ToVpcEndpointSubnetAssociationMapOutput() VpcEndpointSubnetAssociationMapOutput { 204 return i.ToVpcEndpointSubnetAssociationMapOutputWithContext(context.Background()) 205 } 206 207 func (i VpcEndpointSubnetAssociationMap) ToVpcEndpointSubnetAssociationMapOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationMapOutput { 208 return pulumi.ToOutputWithContext(ctx, i).(VpcEndpointSubnetAssociationMapOutput) 209 } 210 211 type VpcEndpointSubnetAssociationOutput struct{ *pulumi.OutputState } 212 213 func (VpcEndpointSubnetAssociationOutput) ElementType() reflect.Type { 214 return reflect.TypeOf((**VpcEndpointSubnetAssociation)(nil)).Elem() 215 } 216 217 func (o VpcEndpointSubnetAssociationOutput) ToVpcEndpointSubnetAssociationOutput() VpcEndpointSubnetAssociationOutput { 218 return o 219 } 220 221 func (o VpcEndpointSubnetAssociationOutput) ToVpcEndpointSubnetAssociationOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationOutput { 222 return o 223 } 224 225 // The ID of the subnet to be associated with the VPC endpoint. 226 func (o VpcEndpointSubnetAssociationOutput) SubnetId() pulumi.StringOutput { 227 return o.ApplyT(func(v *VpcEndpointSubnetAssociation) pulumi.StringOutput { return v.SubnetId }).(pulumi.StringOutput) 228 } 229 230 // The ID of the VPC endpoint with which the subnet will be associated. 231 func (o VpcEndpointSubnetAssociationOutput) VpcEndpointId() pulumi.StringOutput { 232 return o.ApplyT(func(v *VpcEndpointSubnetAssociation) pulumi.StringOutput { return v.VpcEndpointId }).(pulumi.StringOutput) 233 } 234 235 type VpcEndpointSubnetAssociationArrayOutput struct{ *pulumi.OutputState } 236 237 func (VpcEndpointSubnetAssociationArrayOutput) ElementType() reflect.Type { 238 return reflect.TypeOf((*[]*VpcEndpointSubnetAssociation)(nil)).Elem() 239 } 240 241 func (o VpcEndpointSubnetAssociationArrayOutput) ToVpcEndpointSubnetAssociationArrayOutput() VpcEndpointSubnetAssociationArrayOutput { 242 return o 243 } 244 245 func (o VpcEndpointSubnetAssociationArrayOutput) ToVpcEndpointSubnetAssociationArrayOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationArrayOutput { 246 return o 247 } 248 249 func (o VpcEndpointSubnetAssociationArrayOutput) Index(i pulumi.IntInput) VpcEndpointSubnetAssociationOutput { 250 return pulumi.All(o, i).ApplyT(func(vs []interface{}) *VpcEndpointSubnetAssociation { 251 return vs[0].([]*VpcEndpointSubnetAssociation)[vs[1].(int)] 252 }).(VpcEndpointSubnetAssociationOutput) 253 } 254 255 type VpcEndpointSubnetAssociationMapOutput struct{ *pulumi.OutputState } 256 257 func (VpcEndpointSubnetAssociationMapOutput) ElementType() reflect.Type { 258 return reflect.TypeOf((*map[string]*VpcEndpointSubnetAssociation)(nil)).Elem() 259 } 260 261 func (o VpcEndpointSubnetAssociationMapOutput) ToVpcEndpointSubnetAssociationMapOutput() VpcEndpointSubnetAssociationMapOutput { 262 return o 263 } 264 265 func (o VpcEndpointSubnetAssociationMapOutput) ToVpcEndpointSubnetAssociationMapOutputWithContext(ctx context.Context) VpcEndpointSubnetAssociationMapOutput { 266 return o 267 } 268 269 func (o VpcEndpointSubnetAssociationMapOutput) MapIndex(k pulumi.StringInput) VpcEndpointSubnetAssociationOutput { 270 return pulumi.All(o, k).ApplyT(func(vs []interface{}) *VpcEndpointSubnetAssociation { 271 return vs[0].(map[string]*VpcEndpointSubnetAssociation)[vs[1].(string)] 272 }).(VpcEndpointSubnetAssociationOutput) 273 } 274 275 func init() { 276 pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointSubnetAssociationInput)(nil)).Elem(), &VpcEndpointSubnetAssociation{}) 277 pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointSubnetAssociationArrayInput)(nil)).Elem(), VpcEndpointSubnetAssociationArray{}) 278 pulumi.RegisterInputType(reflect.TypeOf((*VpcEndpointSubnetAssociationMapInput)(nil)).Elem(), VpcEndpointSubnetAssociationMap{}) 279 pulumi.RegisterOutputType(VpcEndpointSubnetAssociationOutput{}) 280 pulumi.RegisterOutputType(VpcEndpointSubnetAssociationArrayOutput{}) 281 pulumi.RegisterOutputType(VpcEndpointSubnetAssociationMapOutput{}) 282 }