Terraform v0.12.20
org_account_ids is passed on commandline via
-var org_account_ids=XXX,YYY,ZZZ
resource "aws_config_configuration_aggregator" "lz_aggregator" {
name = "AGGREGATOR"
account_aggregation_source {
account_ids = split(",", var.org_account_ids)
regions = ["eu-west-1", "eu-central-1"]
}
}
2020-01-27T13:14:01.449+0100 [DEBUG] plugin.terraform-provider-aws_v2.46.0_x4: 2020/01/27 13:14:01 [WARN] No such configuration aggregator (aggregator), removing from state
2020/01/27 13:14:01 [DEBUG] aws_config_configuration_aggregator.lz_aggregator: apply errored, but we're indicating that via the Error pointer rather than returning it: Provider produced inconsistent result after apply: When applying changes to aws_config_configuration_aggregator.lz_aggregator, provider "registry.terraform.io/-/aws" produced an unexpected new value for was present, but now absent.
Error: Provider produced inconsistent result after apply
When applying changes to aws_config_configuration_aggregator.lz_aggregator,
provider "registry.terraform.io/-/aws" produced an unexpected new value for
was present, but now absent.
This is a bug in the provider, which should be reported in the provider's own
issue tracker.
# aws_config_configuration_aggregator.lz_aggregator will be created
+ resource "aws_config_configuration_aggregator" "lz_aggregator" {
+ arn = (known after apply)
+ id = (known after apply)
+ name = "AGGREGATOR"
+ account_aggregation_source {
+ account_ids = [
+ "XXX",
+ "YYY",
+ "ZZZ",
]
+ all_regions = false
+ regions = [
+ "eu-west-1",
+ "eu-central-1",
]
}
}
Bombed out with error
HCL listed above
terraform applyImportant fact: the aggregator is specified in full caps in the tf code, but the debug output returns it in lowercase.
I've manually imported the aggregator in the state file using
terraform import aws_config_configuration_aggregator.lz_aggregator AGGREGATOR
and now it deploys without issues (and doesn't try to redeploy it).
This came to light in the terraform 0.11 to 0.12 upgrade.
i think this has got to do with the fact that when setting the id for the resource for some reason a tolower func was used:
d.SetId(strings.ToLower(name))
and when reading it uses the lower case name (in you case it was only upper case):
req := &configservice.DescribeConfigurationAggregatorsInput{
ConfigurationAggregatorNames: []*string{aws.String(d.Id())},
}
this is my hunch.
update:
i am able to recreate the problem the TestAccAWSConfigConfigurationAggregator_account acceptance test when using an upper case name.
it seems that this will be a breaking change to fix this, it's a small change but i will wait for maintaners to respond for a second opinion.
Any idea what would happen with this?
Is there a workaround available? I have encountered this issue too. When I build locally on Mac works find when I build in a container on Jenkins produces "registry.terraform.io/-/aws" produced an unexpected new value for was present, but now absent."
If it's possible use a lower case name for the resource, that should workaround this for now
Thanks will give that a try
Unfortunately this keeps popping up from time to time for me.
Had the issue with Terraform v0.12.28 and provider.aws v3.13.0.
Can confirm that changing the name to lower case fixed the issue.
Most helpful comment
update:
i am able to recreate the problem the
TestAccAWSConfigConfigurationAggregator_accountacceptance test when using an upper case name.it seems that this will be a breaking change to fix this, it's a small change but i will wait for maintaners to respond for a second opinion.