ned1313 / Deep-Dive-Terraform

Exercise files for my Pluralsight course.
200 stars 598 forks source link

Unsupported attribute at m7 tfe_outputs commit plan #31

Open timakamystery opened 1 year ago

timakamystery commented 1 year ago

https://github.com/timakamystery/globo-webapp/blob/tfe-outputs/resources.tf

│ Error: Unsupported attribute │ │ on security_groups.tf line 23, in resource "aws_security_group" "webapp_http_inbound_sg": │ 23: vpc_id = data.tfe_outputs.networking.nonsensitive_values.vpc_id │ ├──────────────── │ │ data.tfe_outputs.networking.nonsensitive_values is object with no attributes │ │ This object does not have an attribute named "vpc_id".

tfe = { source = "hashicorp/tfe" version = "= 0.47.0" }

`diff --git a/datasources.tf b/datasources.tf index bafe7b0..888c009 100644 --- a/datasources.tf +++ b/datasources.tf @@ -4,4 +4,9 @@

data "aws_ssm_parameter" "amzn2_linux" { name = "/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2" +} + +data "tfe_outputs" "networking" {

@@ -120,7 +120,7 @@ resource "aws_lb_target_group" "main" { port = 80 target_type = "instance" protocol = "HTTP"

-variable "public_subnets" {

-variable "vpc_id" { +variable "tfe_workspace_name" { type = string

when doing terraform plan data.tfe_outputs.networking.nonsensitive_values.vpc_id basically is not found. comparing w/the complete code in m9 - it has no diff. also tried. init, then plan from there, - same error. tried both latest 0.49.2 and 0.47.0 of tfe provider, no diff

image

mistwire commented 3 months ago

@timakamystery it's a list, you have to run through the subnet_ids with a [count.index] like this:

on line 32 (if you are doing is just like @ned1313) in resources.tf -

subnet_id = data.tfe_outputs.networking.nonsensitive_values.public_subnets[count.index]