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

Error in Terraform v0.12.8: Inappropriate value for attribute "route_table_ids": element 0: string required. #22805

Closed
jalajarora opened this issue Sep 16, 2019 · 4 comments

Comments

@jalajarora
Copy link

Terraform Version

Terraform v0.12.8
+ provider.aws v2.15.0
+ provider.template v2.1.2

Terraform Configuration Files

resource "aws_vpc_endpoint" "s3" {
  vpc_id            = "${module.vpc.vpc_id}"
  service_name      = "com.amazonaws.eu-west-1.s3"
  vpc_endpoint_type = "Gateway"
  route_table_ids   = ["${module.vpc.private_route_table_ids}"]
}

When I use above I get below error on terraform plan

Debug Output


  on report_generator_s3.tf line 11, in resource "aws_vpc_endpoint" "s3":
  11:   route_table_ids   = ["${module.vpc.private_route_table_ids}"]

Inappropriate value for attribute "route_table_ids": element 0: string
required.

And, I tried doing below as well:

  vpc_id            = "${module.vpc.vpc_id}"
  service_name      = "com.amazonaws.eu-west-1.s3"
  vpc_endpoint_type = "Gateway"
  route_table_ids   = "${module.vpc.private_route_table_ids}"
}

I get the same error on terraform plan

Error: Incorrect attribute value type

  on report_generator_s3.tf line 11, in resource "aws_vpc_endpoint" "s3":
  11:   route_table_ids   = "${module.vpc.private_route_table_ids}"

Inappropriate value for attribute "route_table_ids": element 0: string
required.

Crash Output

Expected Behavior

Actual Behavior

Steps to Reproduce

Additional Context

References

@kmoe
Copy link
Member

kmoe commented Sep 16, 2019

Thanks for the report, @jalajarora.

Since the value you want to interpolate, module.vpc.private_route_table_ids, is in another module, please include this module in your report, or use a variable to create a minimal reproduction case if it doesn't matter that it's from another module.

@kmoe kmoe added the waiting-response An issue/pull request is waiting for a response from the community label Sep 16, 2019
@jalajarora
Copy link
Author

Hi @kmoe Thanks for your reply.
flatten function seems to resolve the issue.

  route_table_ids   = flatten(["${module.vpc.private_route_table_ids}"])

@ghost ghost removed the waiting-response An issue/pull request is waiting for a response from the community label Sep 16, 2019
@kmoe
Copy link
Member

kmoe commented Sep 16, 2019

That's great to hear. I don't know what the type of your module.vpc.private_route_table_ids variable is, but route_table_ids must be a set of strings, and it sounds like using flatten produced the correct type.

I'm going to close this issue now as this is not a bug in Terraform Core.

@kmoe kmoe closed this as completed Sep 16, 2019
@ghost
Copy link

ghost commented Oct 17, 2019

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 Oct 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants