Skip to content

ec2: networkAclName property in NetworkAcl construct does not work #26897

@tam0ri

Description

@tam0ri

Describe the bug

NetworkAcl L2 construct has networkAclName property.
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.NetworkAcl.html

This is only assigned to physicalName here.

super(scope, id, {
physicalName: props.networkAclName,
});

However, we can't define physical name for AWS::EC2::NetworkAcl resource. The physical name for Network ACL is always automatically generated id.

So, currently networkAclName property is meaningless property. This issue is similar to #26370.

Expected Behavior

In VPC console, a tag value for Name key is shown in Name column as below.
vpc-console-acl-name

So, NetworkAcl L2 construct should add Name tag like Vpc or FlowLog L2 construct.

Tags.of(this).add(NAME_TAG, props.vpcName || this.node.path);

Tags.of(this).add(NAME_TAG, props.flowLogName || this.node.path);

Current Behavior

The value of networkAclName property is never referred in generated CloudFormation template.

Reproduction Steps

We can reproduce it with the following snippet.

    const vpc = ec2.Vpc.fromLookup(this, 'Vpc', {
      isDefault: true,
    });

    new ec2.NetworkAcl(stack, 'MyNetworkAcl', {
      vpc: vpc,
      networkAclName: 'CustomNetworkAclName',
  });

Possible Solution

Adding Name tag with the value of networkAclName property.

Additional Information/Context

No response

CDK CLI Version

v2.93.0

Framework Version

No response

Node.js Version

v18.17.1

OS

Amazon Linux 2

Language

Typescript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    @aws-cdk/aws-ec2Related to Amazon Elastic Compute CloudbugThis issue is a bug.effort/smallSmall work item – less than a day of effortp2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions