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.75k stars 9.11k forks source link

[Bug]: Error changing aws_codebuild_fleet resource after importing #39362

Open albertored11 opened 4 days ago

albertored11 commented 4 days ago

Terraform Core Version

1.9.5

AWS Provider Version

5.67.0

Affected Resource(s)

Expected Behavior

When trying to modify the configuration of this resource, the changes should be applied without any issues.

Actual Behavior

If the resource has been imported, the modify fails when trying to perform the UpdateFleet operation, stating the ARN of the resource is invalid.

Relevant Error/Panic Output Snippet

aws_codebuild_fleet.this: Modifying... [id=MyFleet]
╷
│ Error: updating AWS CodeBuild Fleet (MyFleet): operation error CodeBuild: UpdateFleet, https response error StatusCode: 400, RequestID: xxxx, InvalidInputException: Invalid fleet ARN
│ 
│   with aws_codebuild_fleet.this,
│   on codebuild.tf line 1, in resource "aws_codebuild_fleet" "this":
│    1: resource "aws_codebuild_fleet" "this" {
│ 
╵

Terraform Configuration Files

aws_codebuild_fleet.zip

Steps to Reproduce

  1. Create manually a compute fleet named ToBeDeleted1 using the AWS console. Set Overflow behavior to Queue.
  2. Import resource: terraform import aws_codebuild_fleet.this ToBeDeleted1.
  3. Run terraform apply -auto-approve.

Debug Output

No response

Panic Output

No response

Important Factoids

Comparing the resource objects in the Terraform state file between an imported resource and a resource created with Terraform, the only difference is in instances.attributes.id: the first one contains the name of the fleet, while the second one contains its ARN.

The error says that the ARN of the fleet is invalid, which makes me think that the ARN is being read from id, which in one case it contains the ARN, but in the other one, it contains the name.

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 4 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue