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
aws_subnet_ids Data source is returning String #9381
Comments
+1 I have just encountered that same issue:
|
+1 Same issue for me. Issue occurred at --> subnet_id = "${element(data.aws_subnet_ids.test.ids, 0)}
|
Having the same issue with
As a workaround splat syntax works subnet_id = element(data.aws_subnet_ids.foobar.ids[*], count.index) |
Trying the work around did not work for me
Gets this error
while the VPC has been created |
Tried using locals instead of element. This worked for me:
|
Convert it to a list should work data "aws_subnet_ids" "private" { tags = { resource "aws_instance" "app" { |
I used something like this :
|
@toddlers Yes |
As @ninjapugdevil and @rajivreddy mentioned, using the See: |
Someone really needs to update the docs to say that then. "aws_subnet_ids provides a list of ids for a vpc_id"
|
Hi @bbaptist, |
This works for me. Thanks |
Thanks, this works. Strange that it doesn't work directly, if it looks like a list, then I want to access it like a list. |
I did that one a little bit differently than using count in my target resource.
|
The new |
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. |
This issue was originally opened by @rajivreddy as hashicorp/terraform#22099. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
data.tf
main.tf
Expected Behavior
aws_nat_gateway modules should be able to get individual public_subnet_ids based on count.index based on https://www.terraform.io/docs/providers/aws/d/subnet_ids.html#example-usage
As return value of data.aws_subnet_ids.public_subnet_ids.ids should be a list
Actual Behavior
Steps to Reproduce
Please list the full steps required to reproduce the issue, for example:
use the example listed https://www.terraform.io/docs/providers/aws/d/subnet_ids.html#example-usage with 0.12.x TF version
terraform init
terraform plan
terraform apply
References
The text was updated successfully, but these errors were encountered: