-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Using aws_region in module with module depends_on causes inconsistent plan on tags_all #20387
Comments
I'm seeing the same issue with Start The minimal example I used was this: ./main.tf terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
provider "aws" {
region = "us-east-1"
access_key = "0"
secret_key = "0"
s3_force_path_style = true
skip_credentials_validation = true
skip_metadata_api_check = true
skip_requesting_account_id = true
endpoints {
ssm = "http://localhost:4566"
}
default_tags {
tags = {
one = "two"
}
}
}
locals {
name = "example"
}
resource "aws_ssm_parameter" "example" {
name = local.name
type = "String"
value = "example"
}
module "m" {
source = "./m"
depends_on = [aws_ssm_parameter.example]
name = local.name
} ./m/main.tf terraform {
required_providers {
aws = {
source = "hashicorp/aws"
}
}
}
data "aws_region" "current" {}
locals {
name = "${data.aws_region.current.name}.${var.name}"
}
variable "name" {
type = string
}
resource "aws_ssm_parameter" "example" {
name = local.name
type = "String"
value = "example"
tags = {
name = local.name
}
} Worth to note is perhaps that if |
There are a large number of similar reports of this, the most active in terms of comments appears to be #19583 |
Hey all 👋 Thank you very much for taking the time to raise this! This was addressed with #29747, which was included in version |
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. |
There appears to be an issue with inconsistent final plan error on tags_all when adding or overriding tags with values that are "known after apply".
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Potentially others contained in a module; these are just the ones I was using
Terraform Configuration Files
Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.
./main.tf
./tgw/tgw.tf
./peering/peering.tf
Debug Output
Shell transcript from
terraform apply
of above scriptExpected Behavior
The final plan should not have been inconsistent — if a resource's tags value is
(known after apply)
then terraform likely should not get upset thattags_all
changed as a result.Actual Behavior
An inconsistent final plan error as the tags changed after a data resource became available.
Steps to Reproduce
terraform apply
on the files included aboveImportant Factoids
This is a cut-down example — I do (think I) need to use the modules in this way. In my full script, without depends_on, I get races between parts of of the tgw module finishing and the parts of the peering module that depend on those bits of the tgw module.
Without the depends_on in the module call sites, the data.aws_region data sources inside the peering module are fully determined in the plan, rather than being "known after apply". I don't think that has to be the case as the aws_region of a provide isn't going to change.
The text was updated successfully, but these errors were encountered: