hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.82k stars 9.16k forks source link

[Bug]: in aws_codepipeline when run_order is not defined you get inconsistent results #36946

Open swarner1033 opened 6 months ago

swarner1033 commented 6 months ago

Terraform Core Version

v1.5.7

AWS Provider Version

v5.45.0

Affected Resource(s)

aws_codepipeline

Expected Behavior

If run_order is not specified in a codepipeline action it should have a consistent result.

Actual Behavior

When you create a new two action stage with run_action not specified you get an order of 1,2. However if you manually change the run order it does not change the run order back to 1,2 when you apply again.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_codepipeline" "" {
  name     = "pipeline-name"
  ...
  stage {
  name = "multi action stage"

  action {
    name = "non-dependant action A"
    run_order = 1
    ...
  }

  action {
    name = "non-dependant action B"
    run_order = 1
    ...
  }
}

Steps to Reproduce

When creating two actions within a stage

Spec Outcome
Don't specify run_order Actions have 1,2 order
Then manually change run order to be 1,1 and run apply No change occurs
Specify run_order as 1,2 and run apply Terraform detects second action should change 1->2
Remove run_order and run plan No change detected

It seems the state just reads the current run order and only compares to the spec it if run_order is specified. However this means that the resources could be in many different states if run_order is not specified and terraform would think they were the same.

Additionally, I don't think that upon resource creation the default should be 1,2 as this is an unnecessary dependancy. Previously it defaulted to 1,1.

Debug Output

No response

Panic Output

No response

Important Factoids

Previously it defaulted to 1,1.

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 6 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue