Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

availabilityZone is mandatory inside SubnetAttributes while using Subnet.fromSubnetAttributes #6607

Closed
nirvana124 opened this issue Mar 6, 2020 · 1 comment · Fixed by #6667
Assignees
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.

Comments

@nirvana124
Copy link
Contributor

❓ General Issue

The Question

To get subnet details if we are using Subnet.fromSubnetAttributes we are required to pass SubnetAttributes. Inside SubnetAttributes we have availabilityZone which is defined as mandatory.
Even if we do not pass empty string there it works fine.
Can we make availabilityZone optional or i am missing something here ?

Subnet.fromSubnetAttributes(this, 'MySubnet', {
subnetId: 'sb-123456789',
availabilityZone: ''
})
Also inside cfn template only subnet ids are present.

Environment

  • CDK CLI Version: 1.27.0
  • Module Version: 1.27.0
  • OS: Windows 10
  • Language: TypeScript

Other information

@nirvana124 nirvana124 added the needs-triage This issue or PR still needs to be triaged. label Mar 6, 2020
@SomayaB SomayaB added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Mar 6, 2020
@SomayaB SomayaB added the guidance Question that needs advice or information. label Mar 6, 2020
@rix0rrr
Copy link
Contributor

rix0rrr commented Mar 9, 2020

AZs will be used sometimes in subnet selection (such as, for example, to evaluate subnet queries using onePerAz: true).

If you don't care about those, it's fine to pass an empty string.

We can consider making the AZ property optional and throw a runtime error if you use a mechanism that uses AZ information saying something like "you must specify AZs if you want to do this."

We'll consider it as a feature request.

@rix0rrr rix0rrr added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. and removed guidance Question that needs advice or information. labels Mar 9, 2020
@SomayaB SomayaB added in-progress This issue is being actively worked on. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 12, 2020
@mergify mergify bot closed this as completed in #6667 Mar 17, 2020
mergify bot pushed a commit that referenced this issue Mar 17, 2020
availabilityZone attribute inside SubnetAttributes is only used for subnet selection.
AZ restrictions are not mandatory so making availabilityZone as optional.
Also as AZ is optional we should be able to search subnet using only subnet id.
Added fromSubnetId as well.

fixes #6607
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.
Projects
None yet
3 participants