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

r/aws_cloudformation_stack: outputs not showing as changed during resource update #32744

Closed
ewbankkit opened this issue Jul 28, 2023 · 4 comments · Fixed by #33059
Closed

r/aws_cloudformation_stack: outputs not showing as changed during resource update #32744

ewbankkit opened this issue Jul 28, 2023 · 4 comments · Fixed by #33059
Labels
bug Addresses a defect in current functionality. service/cloudformation Issues and PRs that pertain to the cloudformation service.
Milestone

Comments

@ewbankkit
Copy link
Contributor

ewbankkit commented Jul 28, 2023

Consider this CloudFormation stack:

provider "aws" {}

resource "aws_cloudformation_stack" "test" {
  name = "test"

  template_body = <<STACK
  {
    "AWSTemplateFormatVersion": "2010-09-09",
    "Description": "AWS CloudFormation template that a transformed copy of its input parameter",
    "Parameters": {
      "DataIn": {
        "Type": "String",
        "Description": "Input data"
      }
    },
    "Resources": {
      "NullResource": {
        "Type": "AWS::CloudFormation::WaitConditionHandle"
      }
    },
    "Outputs": {
      "DataOut": {
        "Description": "Output data",
        "Value": {
          "Fn::Join": [
            "",
            [
              "pre-",
              {
                "Ref": "DataIn"
              },
              "-post"
            ]
          ]
        }
      }
    }
}
STACK

  parameters = {
    DataIn = "in1"
  }
}

where outputs depend on parameters.
If the resource is updated by changing parameters (DataIn from "in1" to "in2") then outputs will be updated, however terraform plan does not show that:

% terraform plan

aws_cloudformation_stack.test: Refreshing state... [id=arn:aws:cloudformation:us-west-2:123456789012:stack/test/6381c4a0-2d70-11ee-8daa-026e6b178b5f]

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_cloudformation_stack.test will be updated in-place
  ~ resource "aws_cloudformation_stack" "test" {
        id                 = "arn:aws:cloudformation:us-west-2:123456789012:stack/test/6381c4a0-2d70-11ee-8daa-026e6b178b5f"
        name               = "test"
      ~ parameters         = {
          ~ "DataIn" = "in1" -> "in2"
        }
        tags               = {}
        # (5 unchanged attributes hidden)
    }

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

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

We should expect to see

Terraform used the selected providers to generate the following execution plan. Resource actions are indicated with the following
symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_cloudformation_stack.test will be updated in-place
  ~ resource "aws_cloudformation_stack" "test" {
        id                 = "arn:aws:cloudformation:us-west-2:123456789012:stack/test/6381c4a0-2d70-11ee-8daa-026e6b178b5f"
        name               = "test"
      ~ outputs            = {
          - "DataOut" = "pre-in1-post"
        } -> (known after apply)
      ~ parameters         = {
          ~ "DataIn" = "in1" -> "in2"
        }
        tags               = {}
        # (4 unchanged attributes hidden)
    }

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

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

in the plan.

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • 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.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@ewbankkit ewbankkit changed the title r/aws_cloudformation_stack: outputs not showing as changed during resource update r/aws_cloudformation_stack: outputs not showing as changed during resource update Jul 28, 2023
@github-actions github-actions bot added the service/cloudformation Issues and PRs that pertain to the cloudformation service. label Jul 28, 2023
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Jul 28, 2023
@ewbankkit
Copy link
Contributor Author

Hmm.
If we indiscriminately set outputs to newly computed whenever parameters (or the template) changes then we will cause to falsely show changes, and that's a breaking change.
I'm going to close this one while we think...

@ewbankkit ewbankkit closed this as not planned Won't fix, can't repro, duplicate, stale Jul 31, 2023
@gdavison gdavison reopened this Aug 16, 2023
@github-actions github-actions bot added this to the v5.13.0 milestone Aug 17, 2023
@github-actions
Copy link

This functionality has been released in v5.13.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. Thank you!

@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2023
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/cloudformation Issues and PRs that pertain to the cloudformation service.
Projects
None yet
2 participants