简体   繁体   中英

Terraform plan outputs incorrect results

Terraform plan outputs strange results. For every load balancer, it outputs

~ module.api-origin-demo-prod.aws_alb.origin-alb
  enable_cross_zone_load_balancing:         "" => "false"
  enable_http2:                             "" => "true"

From what I understand, cross zone load balancing is a feature for AWS's classic load balancers, not the application load balancers (ALBs) we use. The HTTP2 setting is strange too becuase it's enabled in the AWS console, so they're is no "change" in the settings that Terraform should pick up. Thanks!

I would suggest setting your terminal env variable to Debug so you can see what's happening behind the scenes .

To do that in your terminal assumed you have installed the terraform

Do : export TF_LOG="DEBUG" That should be enough for giving you output and debug your next steps.

aws_alb aka aws_lb implements both ALBs and network load balancers based on the setting of the load_balancer_type argument. enable_cross_zone_load_balancing is only applicable to network load balancers.

You could try terraform show to see what the current state of those attributes are. It is possible for terraform's state to diverge from reality if the infrastructure is being modified in AWS' console or by other tools. If you aren't using remote state, there can be divergence even if terraform is being used exclusively.

If something really seems amiss, you can enable debug logs and search for the relevant API calls for the ALBs to see how it believes there is a change:

TF_LOG=DEBUG terraform plan

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM