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
resource/aws_codepipeline: Crash when missing artifact_store or using multiple artifact stores #7573
Comments
error which causing the crash,
|
Hi @MarkAyliffe 👋 Sorry you ran into this unexpected behavior here. Could you please provide a little more detail about your CodePipeline configuration or any recent changes to it (potentially outside Terraform)? In particular, it would be helpful to know if your CodePipeline has cross-region actions enabled, which uses multiple artifact stores, and is not currently supported by the Terraform resource. We can prevent the panic, but will need to either implement the new CodePipeline feature or return an error in this situation. References: |
Cross-region feature request issue: #6871 |
Apologies for my slow response @bflad The problem seems to be intermittent. Some of my scripts do operate cross region and cross account. The latest case of the crash was in one of my CICD scripts. I was working on adding a Lambda Invoke action in a CodePipeline deploy stage. The action had been created OK by Terraform, but when I made an adjustment to the script (sorry I can't remember the detail), the crash occurred as before with both plan and apply. Manually deleting the Deploy stage in the AWS console cleared the problem and Terraform successfully re-created the missing stage. This script does refer to an S3 bucket in a different region, but that was not part of the change in view when the crash happened. There is no cross-account activity in this script at present. I was doing the cross account deploy in the Lambda function, which was still manually created at that point. |
Something else odd - seen this show up in different versions of the SDK. As in (python example here):
Where-as in the earlier SDK, didn't show up with a region... possibly something server side going on? |
This bit us pretty badly. Essentially, when a developer manually (using the AWS Console) changes the source used in the source stage of the pipeline, even though there is nothing cross-region in the pipeline, the pipeline is then changed to use
rather than the previous format as put in by terraform which is
We are unable to do a terraform plan or even a terraform destroy, due to the panic. We have been working with the ability to change the source branch in the console for ages, and the first thought was that it was due to the updated terraform-provider-aws_v1.59.0. However, we then went back to the branch that had previously run through successfully, with terraform version 0.11.8 and terraform-provider-aws_v1.57.0 which had been in place at the time of the previous successful run, but still had same terraform panic. I suspect something changed at the AWS end such that if you modify a pipeline using the console, the configuration is written out to support cross-region, even if there are no cross-region actions. This bug needs to be bumped up the priority list, as it is a breaking change even with no changes to terraform versions. |
So my pipline as generated by terraform has two input artifacts...
This went okay, but when the pipeline ran, it complained that there was no "primary source". I updated the pipeline by hand which removed the error from the aws console when I run the pipeline, but now when I run terraform (plan or apply as per the OP) ...
Only thing I could do was to delete the pipline and re-terraform, but still have the issue that my pipeline does not run |
We debugged this on our side too and whenever a change is made in the ui, the json for the call to get deployment pipeline current state changes to this:
Stack trace:
We tracked down the issue to https://github.com/terraform-providers/terraform-provider-aws/blob/04340792ac1c2b355fb7143814a737de84f047e7/aws/resource_aws_codepipeline.go#L228 it assumes the artifactStore is a singular version present in the file, and in our case, after every edit in the UI, it is not. Documentation in https://docs.aws.amazon.com/cli/latest/reference/codepipeline/update-pipeline.html seems ambivalent on which format is supported, but the UI right now always moves to multi-region from a single one. |
Has this been fixed in 2.0? |
Nope. PR is not merged yet. |
Any idea on when the fix will get merged in? We have over 100 pipelines configured through terraform in one region alone. |
The fix for this (multi-region handling in the |
This has been released in version 2.56.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! |
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! |
This issue was originally opened by @MarkAyliffe as hashicorp/terraform#20355. It was migrated here as a result of the provider split. The original body of the issue is below.
As title
Crash Output
crash.log
Expected Behavior
It should work without crashing like it has for the last couple of months!
Actual Behavior
Terraform crashes if I try terraform plan or terraform apply.
The text was updated successfully, but these errors were encountered: