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

aws_config_configuration_aggregator: Provider produced inconsistent result after apply #11769

Closed
jdeluyck opened this issue Jan 27, 2020 · 12 comments · Fixed by #14247
Closed
Labels
bug Addresses a defect in current functionality. service/configservice Issues and PRs that pertain to the configservice service.
Milestone

Comments

@jdeluyck
Copy link

jdeluyck commented Jan 27, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v0.12.20

  • provider.aws v2.46.0

Affected Resource(s)

  • aws_config_configuration_aggregator

Terraform Configuration Files

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"]
  }
}

Debug Output

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.

Panic Output

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.

Expected Behavior

  # 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",
            ]
        }
    }

Actual Behavior

Bombed out with error

Steps to Reproduce

HCL listed above

  1. terraform apply

Important Factoids

Important 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.

References

  • #0000
@ghost ghost added the service/configservice Issues and PRs that pertain to the configservice service. label Jan 27, 2020
@jdeluyck jdeluyck changed the title aws_config_configuration_aggregator: Provider produced inconsistent result after applyˇ aws_config_configuration_aggregator: Provider produced inconsistent result after apply Jan 27, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Jan 27, 2020
@DrFaust92
Copy link
Collaborator

DrFaust92 commented Jan 27, 2020

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.

@DrFaust92
Copy link
Collaborator

DrFaust92 commented Jan 27, 2020

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.

@jdeluyck
Copy link
Author

Any idea what would happen with this?

@jrgwv
Copy link

jrgwv commented Apr 21, 2020

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."

@DrFaust92
Copy link
Collaborator

DrFaust92 commented Apr 21, 2020

If it's possible use a lower case name for the resource, that should workaround this for now

@jrgwv
Copy link

jrgwv commented Apr 21, 2020

Thanks will give that a try

@jdeluyck
Copy link
Author

Unfortunately this keeps popping up from time to time for me.

@DrFaust92 DrFaust92 added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 19, 2020
@idnorton
Copy link

idnorton commented Nov 4, 2020

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.

@denisse-dev
Copy link

Any updates on this? This issue has been open for almost a year and it's still giving problems.

@rtoma
Copy link

rtoma commented Mar 13, 2021

Same with:

Terraform v0.14.7
+ provider registry.terraform.io/hashicorp/aws v3.31.0

... using:

resource "aws_config_configuration_aggregator" "default" {
  name = "OrganizationAllAccountsAllRegions"
  organization_aggregation_source {
    all_regions = true
    role_arn    = aws_iam_role.organization.arn
  }
  depends_on = [aws_iam_role_policy_attachment.organization]
}

This fails. Fixed by changing aws_config_configuration_aggregator.name to not contain upper case characters (eg org-all-accounts-all-regions).

And as mentioned before. Even though terraform fails, the aggregator with capitals is created:
image

@ghost
Copy link

ghost commented Mar 26, 2021

This has been released in version 3.34.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Apr 25, 2021

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/configservice Issues and PRs that pertain to the configservice service.
Projects
None yet
6 participants