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

Creating a new aws_config_configuration_aggregator appears to not add to state if name has uppercase letters #8432

Closed
tdmalone opened this issue Apr 25, 2019 · 6 comments · Fixed by #14247
Labels
bug Addresses a defect in current functionality. service/configservice Issues and PRs that pertain to the configservice service. service/sts Issues and PRs that pertain to the sts service.
Milestone

Comments

@tdmalone
Copy link
Contributor

tdmalone commented Apr 25, 2019

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 "me too" comments, 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.11.13
+ provider.aws v2.7.0

Affected Resource(s)

Terraform Configuration Files

data "aws_caller_identity" "current" {}

resource "aws_config_configuration_aggregator" "account" {
  name = "MyAccountAggregator"

  account_aggregation_source {
    all_regions = true
    account_ids = ["${data.aws_caller_identity.current.account_id}"]
  }
}

Expected Behavior

  • ✅ Aggregator created successfully
  • ✅ New resource saved in state, with no changes on a subsequent apply

Actual Behavior

  • ✅ Aggregator created successfully
  • ❌ Terraform appears to not be aware of the new resource when running a subsequent apply

Steps to Reproduce

  1. Run terraform apply
  2. Observe that the new aggregator now exists at https://console.aws.amazon.com/config/home?#/aggregators/view
  3. Run terraform apply again
  4. Observe that Terraform creates the resource again, with no knowledge of the resource previously created
  5. Repeat the last two steps as much as you like
  6. Run terraform import aws_config_configuration_aggregator.account MyAccountAggregator
  7. Run terraform apply again
  8. Observe that the aggregator is now no longer planned for creation

Important Factoids

I haven't redacted any sensitive tokens from the debug output so I haven't got the entire thing to post, but I did save debug output for each run and did a diff. This stood out:

[DEBUG] plugin.terraform-provider-aws_v2.7.0_x4: [WARN] No such configuration aggregator (myaccountaggregator), removing from state

...which led to me to try the same exercise again, with the name my-account-aggregator instead. This worked fine.

So it appears that:

  • aggregators using CamelCase in their names do not get added to state on apply (but they do on import)
  • aggregators using kebab-case in their names do get added to state on apply
@aeschright aeschright added needs-triage Waiting for first response or review from a maintainer. service/configservice Issues and PRs that pertain to the configservice service. labels Jun 19, 2019
@nebffa
Copy link

nebffa commented Aug 7, 2019

I actually run into Error: Provider produced inconsistent result after apply because of this.

@seanmcelroy
Copy link

seanmcelroy commented Aug 22, 2019

I have what I believe is a related issue:

resource "aws_config_configuration_aggregator" "account" {
  count = "${var.aws_account_id == "XXXXXXXXXXXX" ? 1 : 0}"
  name  = "XXXXXXXXXXXX"

  account_aggregation_source {
    account_ids = [
      for acct in var.non_security_member_accounts :
      acct.aws_account_id
    ]
    all_regions = true
  }
}

Execution plan results in:

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # module.config.aws_config_configuration_aggregator.account[0] will be updated in-place
  ~ resource "aws_config_configuration_aggregator" "account" {
        arn  = "arn:aws:config:us-west-2:XXXXXXXXXXXX:config-aggregator/config-aggregator-jhbprejd"
        id   = "XXXXXXXXXXXX"
        name = "XXXXXXXXXXXX"

      ~ account_aggregation_source {
          ~ account_ids = [
                "AAAAAAAAAAAA",
              - "BBBBBBBBBBBB",
              - "CCCCCCCCCCCC",
                "DDDDDDDDDDDD",
                "EEEEEEEEEEEE",
              + "BBBBBBBBBBBB",
            ]
            all_regions = true
            regions     = []
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

I did expect to see CCCCCCCCCCCC removed, as it's not part of the list I'm passing in to the variable. However, notice B is both added and removed. Attempting to apply results in:

Error: Provider produced inconsistent result after apply

When applying changes to
module.config.aws_config_configuration_aggregator.account[0], provider "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.

I believe this part of related state management problems for this resource.

@aeschright aeschright added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 14, 2019
@rekkeb
Copy link

rekkeb commented Aug 18, 2020

Same behavior is still present in version 3.2.0...

Terraform v0.12.29
+ provider.aws v3.2.0

@ghost ghost added the service/sts Issues and PRs that pertain to the sts service. label Aug 31, 2020
@pritho
Copy link

pritho commented Sep 29, 2020

still same problem with 3.7

@github-actions github-actions bot added this to the v3.34.0 milestone Mar 25, 2021
@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. service/sts Issues and PRs that pertain to the sts service.
Projects
None yet
6 participants