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

Remnant CloudWatch Dashboards persist on each dashboard rename #9782

Closed
JamesPeiris opened this issue Aug 15, 2019 · 3 comments · Fixed by #9784
Closed

Remnant CloudWatch Dashboards persist on each dashboard rename #9782

JamesPeiris opened this issue Aug 15, 2019 · 3 comments · Fixed by #9784
Labels
bug Addresses a defect in current functionality. service/cloudwatch Issues and PRs that pertain to the cloudwatch service.
Milestone

Comments

@JamesPeiris
Copy link
Contributor

JamesPeiris commented Aug 15, 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

v0.11.13

Affected Resource(s)

  • aws_cloudwatch_dashboard

Terraform Configuration Files

resource "aws_cloudwatch_dashboard" "example" {
  dashboard_name = "dashboard-name-before"

  dashboard_body = <<EOF
    {
      ... some JSON
    }
  EOF
}

Debug Output

N/A - no relevant debug output - the bug only presents itself in the AWS Console

Panic Output

N/A - no panics

Expected Behavior

On update of the dashboard resource's dashboard_name
✅ The dashboard with the new name should be deployed to AWS
✅ The dashboard with the original name should be destroyed in AWS

Actual Behavior

On update of the dashboard resource's dashboard_name
✅ The dashboard with the new name is deployed to AWS
❌ The dashboard with the original name is not destroyed in AWS

Steps to Reproduce

  1. Deploy a dashboard with some arbitrary dashboard_body JSON
  2. Check the dashboard exists and has the correct name.
    image
  3. Check the terraform state reflects the deployed infrastructure
{
  "version": 3,
  "terraform_version": "0.11.13",
  "serial": 1,
  "lineage": "cc8370ef-4c74-de56-db09-db767317bb9c",
  "modules": [
    {
      "path": [
        "root"
      ],
      "outputs": {},
      "resources": {
        "aws_cloudwatch_dashboard.main": {
          "type": "aws_cloudwatch_dashboard",
          "depends_on": [],
          "primary": {
            "id": "dashboard-name-before",
            "attributes": {
              "dashboard_arn": "arn:aws:cloudwatch::<ACCOUNT_ID>:dashboard/dashboard-name-before",
              "dashboard_body": " { ... Dashboard Body JSON here... } ",
              "dashboard_name": "dashboard-name-before",
              "id": "dashboard-name-before"
            },
            "meta": {},
            "tainted": false
          },
          "deposed": [],
          "provider": "provider.aws"
        }
      },
      "depends_on": []
    }
  ]
}
  1. Once deployed, change only the dashboard_name property
  2. Run terraform plan to see the "update-in-place" output:
~ aws_cloudwatch_dashboard.main
    dashboard_name: "dashboard-name-before" => "dashboard-name-after"

Plan: 0 to add, 1 to change, 0 to destroy.
  1. Run terraform apply
  2. Check the renamed dashboard exists and has the correct name.
    8. Confirm that the old dashboard still exists
    image
    9. Confirm that only the new dashboard exists in the terraform state
{
  "version": 3,
  "terraform_version": "0.11.13",
  "serial": 2,
  "lineage": "cc8370ef-4c74-de56-db09-db767317bb9c",
  "modules": [
    {
      "path": [
        "root"
      ],
      "outputs": {},
      "resources": {
        "aws_cloudwatch_dashboard.main": {
          "type": "aws_cloudwatch_dashboard",
          "depends_on": [],
          "primary": {
            "id": "dashboard-name-after",
            "attributes": {
              "dashboard_arn": "arn:aws:cloudwatch::<ACCOUNT_ID>:dashboard/dashboard-name-after",
              "dashboard_body": " { ... Dashboard Body JSON here... } ",
              "dashboard_name": "dashboard-name-after",
              "id": "dashboard-name-after"
            },
            "meta": {},
            "tainted": false
          },
          "deposed": [],
          "provider": "provider.aws"
        }
      },
      "depends_on": []
    }
  ]
}

Important Factoids

N/A - reproduced on personal and work account

References

  • N/A
@ghost ghost added the service/cloudwatch Issues and PRs that pertain to the cloudwatch service. label Aug 15, 2019
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 15, 2019
@bflad bflad added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 19, 2019
@bflad bflad added this to the v2.44.0 milestone Jan 2, 2020
@bflad
Copy link
Contributor

bflad commented Jan 2, 2020

The fix for this has been merged and will release with version 2.44.0 of the Terraform AWS Provider, next Thursday. Thanks to @JamesPeiris for the implementation. 👍

@ghost
Copy link

ghost commented Jan 10, 2020

This has been released in version 2.44.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 Mar 27, 2020

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 and limited conversation to collaborators Mar 27, 2020
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/cloudwatch Issues and PRs that pertain to the cloudwatch service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants