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

Get AvailableIpAddressCount from aws_subnet Data Source #23781

Closed
MMarulla opened this issue Jan 3, 2020 · 2 comments
Closed

Get AvailableIpAddressCount from aws_subnet Data Source #23781

MMarulla opened this issue Jan 3, 2020 · 2 comments

Comments

@MMarulla
Copy link

MMarulla commented Jan 3, 2020

Current Terraform Version

Terraform v0.12.6
+ provider.aws v2.33.0

Use-cases

Assign new instances to the least subscribed subnet in a VPC.

Proposal

The aws_subnet data source relies on the underlying EC2 describe-subnets API. One of the values returned by that call is the number of available IP addresses in the subnet:

AvailableIpAddressCount -> (integer)
The number of unused private IPv4 addresses in the subnet. The IPv4 addresses for any stopped instances are considered unavailable.

If that field were included in the result attributes of aws_subnet data source, a decision could be made in code as to which subnet to place a new instance.

Note that available-ip-address-count can be passed as a filter value in the aws_subnet data source, but that does not help in finding the least subscribed subnet without repeated trail-and-error calls.

References

https://www.terraform.io/docs/providers/aws/d/subnet.html
https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-subnets.html

@ghost
Copy link

ghost commented Jan 6, 2020

This issue has been automatically migrated to hashicorp/terraform-provider-aws#11493 because it looks like an issue with that provider. If you believe this is not an issue with the provider, please reply to hashicorp/terraform-provider-aws#11493.

@ghost ghost closed this as completed Jan 6, 2020
@ghost
Copy link

ghost commented Feb 6, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Feb 6, 2020
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants