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