aws.ec2.NetworkAclAssociation
Explore with Pulumi AI
Provides an network ACL association resource which allows you to associate your network ACL with any subnet(s).
NOTE on Network ACLs and Network ACL Associations: the provider provides both a standalone network ACL association resource and a network ACL resource with a
subnet_ids
attribute. Do not use the same subnet ID in both a network ACL resource and a network ACL association resource. Doing so will cause a conflict of associations and will overwrite the association.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const main = new aws.ec2.NetworkAclAssociation("main", {
networkAclId: mainAwsNetworkAcl.id,
subnetId: mainAwsSubnet.id,
});
import pulumi
import pulumi_aws as aws
main = aws.ec2.NetworkAclAssociation("main",
network_acl_id=main_aws_network_acl["id"],
subnet_id=main_aws_subnet["id"])
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/ec2"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := ec2.NewNetworkAclAssociation(ctx, "main", &ec2.NetworkAclAssociationArgs{
NetworkAclId: pulumi.Any(mainAwsNetworkAcl.Id),
SubnetId: pulumi.Any(mainAwsSubnet.Id),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var main = new Aws.Ec2.NetworkAclAssociation("main", new()
{
NetworkAclId = mainAwsNetworkAcl.Id,
SubnetId = mainAwsSubnet.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.ec2.NetworkAclAssociation;
import com.pulumi.aws.ec2.NetworkAclAssociationArgs;
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 main = new NetworkAclAssociation("main", NetworkAclAssociationArgs.builder()
.networkAclId(mainAwsNetworkAcl.id())
.subnetId(mainAwsSubnet.id())
.build());
}
}
resources:
main:
type: aws:ec2:NetworkAclAssociation
properties:
networkAclId: ${mainAwsNetworkAcl.id}
subnetId: ${mainAwsSubnet.id}
Create NetworkAclAssociation Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new NetworkAclAssociation(name: string, args: NetworkAclAssociationArgs, opts?: CustomResourceOptions);
@overload
def NetworkAclAssociation(resource_name: str,
args: NetworkAclAssociationArgs,
opts: Optional[ResourceOptions] = None)
@overload
def NetworkAclAssociation(resource_name: str,
opts: Optional[ResourceOptions] = None,
network_acl_id: Optional[str] = None,
subnet_id: Optional[str] = None)
func NewNetworkAclAssociation(ctx *Context, name string, args NetworkAclAssociationArgs, opts ...ResourceOption) (*NetworkAclAssociation, error)
public NetworkAclAssociation(string name, NetworkAclAssociationArgs args, CustomResourceOptions? opts = null)
public NetworkAclAssociation(String name, NetworkAclAssociationArgs args)
public NetworkAclAssociation(String name, NetworkAclAssociationArgs args, CustomResourceOptions options)
type: aws:ec2:NetworkAclAssociation
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args NetworkAclAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args NetworkAclAssociationArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args NetworkAclAssociationArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args NetworkAclAssociationArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args NetworkAclAssociationArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var networkAclAssociationResource = new Aws.Ec2.NetworkAclAssociation("networkAclAssociationResource", new()
{
NetworkAclId = "string",
SubnetId = "string",
});
example, err := ec2.NewNetworkAclAssociation(ctx, "networkAclAssociationResource", &ec2.NetworkAclAssociationArgs{
NetworkAclId: pulumi.String("string"),
SubnetId: pulumi.String("string"),
})
var networkAclAssociationResource = new NetworkAclAssociation("networkAclAssociationResource", NetworkAclAssociationArgs.builder()
.networkAclId("string")
.subnetId("string")
.build());
network_acl_association_resource = aws.ec2.NetworkAclAssociation("networkAclAssociationResource",
network_acl_id="string",
subnet_id="string")
const networkAclAssociationResource = new aws.ec2.NetworkAclAssociation("networkAclAssociationResource", {
networkAclId: "string",
subnetId: "string",
});
type: aws:ec2:NetworkAclAssociation
properties:
networkAclId: string
subnetId: string
NetworkAclAssociation Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The NetworkAclAssociation resource accepts the following input properties:
- Network
Acl stringId - The ID of the network ACL.
- Subnet
Id string - The ID of the associated Subnet.
- Network
Acl stringId - The ID of the network ACL.
- Subnet
Id string - The ID of the associated Subnet.
- network
Acl StringId - The ID of the network ACL.
- subnet
Id String - The ID of the associated Subnet.
- network
Acl stringId - The ID of the network ACL.
- subnet
Id string - The ID of the associated Subnet.
- network_
acl_ strid - The ID of the network ACL.
- subnet_
id str - The ID of the associated Subnet.
- network
Acl StringId - The ID of the network ACL.
- subnet
Id String - The ID of the associated Subnet.
Outputs
All input properties are implicitly available as output properties. Additionally, the NetworkAclAssociation resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing NetworkAclAssociation Resource
Get an existing NetworkAclAssociation resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: NetworkAclAssociationState, opts?: CustomResourceOptions): NetworkAclAssociation
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
network_acl_id: Optional[str] = None,
subnet_id: Optional[str] = None) -> NetworkAclAssociation
func GetNetworkAclAssociation(ctx *Context, name string, id IDInput, state *NetworkAclAssociationState, opts ...ResourceOption) (*NetworkAclAssociation, error)
public static NetworkAclAssociation Get(string name, Input<string> id, NetworkAclAssociationState? state, CustomResourceOptions? opts = null)
public static NetworkAclAssociation get(String name, Output<String> id, NetworkAclAssociationState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Network
Acl stringId - The ID of the network ACL.
- Subnet
Id string - The ID of the associated Subnet.
- Network
Acl stringId - The ID of the network ACL.
- Subnet
Id string - The ID of the associated Subnet.
- network
Acl StringId - The ID of the network ACL.
- subnet
Id String - The ID of the associated Subnet.
- network
Acl stringId - The ID of the network ACL.
- subnet
Id string - The ID of the associated Subnet.
- network_
acl_ strid - The ID of the network ACL.
- subnet_
id str - The ID of the associated Subnet.
- network
Acl StringId - The ID of the network ACL.
- subnet
Id String - The ID of the associated Subnet.
Import
Using pulumi import
, import Network ACL associations using the id
. For example:
$ pulumi import aws:ec2/networkAclAssociation:NetworkAclAssociation main aclassoc-02baf37f20966b3e6
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.