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

[bug] aws terraform state fix #215

Merged
merged 1 commit into from
Mar 7, 2022
Merged

[bug] aws terraform state fix #215

merged 1 commit into from
Mar 7, 2022

Conversation

golubovskyi
Copy link
Contributor

Description

Small fix to prevent terraform state refreshing warning.

aws_autoscaling_group.example: Refreshing state... [id=ir_db1000n]

Note: Objects have changed outside of Terraform

Terraform detected the following changes made outside of Terraform since the last "terraform apply":

  # aws_iam_role.web_iam_role has changed
  ~ resource "aws_iam_role" "web_iam_role" {
      ~ assume_role_policy    = jsonencode(
          ~ {
              ~ Statement = [
                  ~ {
                      ~ Principal = {
                          ~ Service = [
                              - "ec2.amazonaws.com",
                                "ssm.amazonaws.com",
                              + "ec2.amazonaws.com",
                            ]
                        }
                        # (3 unchanged elements hidden)
                    },
                ]
                # (1 unchanged element hidden)
            }
        )
        id                    = "ir_db1000n_role"
        name                  = "ir_db1000n_role"
        tags                  = {}
        # (8 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }


Unless you have made equivalent changes to your configuration, or ignored the relevant attributes using ignore_changes, the following plan may include actions to undo or respond to these changes.

No changes. Your infrastructure matches the configuration.

Your configuration already matches the changes detected above. If you'd like to update the Terraform state to match, create and apply a refresh-only plan:
  terraform apply -refresh-only

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Copy link
Owner

@arriven arriven left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one of the funnier PRs I've reviewed over the week, do we know why that happens as intuitive logic about alphabetical order obviously doesn't apply here?

@arriven arriven merged commit 57fa329 into arriven:main Mar 7, 2022
@golubovskyi golubovskyi deleted the patch-2 branch March 7, 2022 20:15
@golubovskyi
Copy link
Contributor Author

@arriven actually it is related to inline_policy usage and there are a lot of issues in aws provider about it:
hashicorp/terraform-provider-aws#22274
hashicorp/terraform-provider-aws#23421
In our case it's just a luck that it works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants