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.87k stars 9.21k forks source link

[Bug]: Modifying the instance type is not allowed #38536

Open t0yv0 opened 4 months ago

t0yv0 commented 4 months ago

Terraform Core Version

1.6.3

AWS Provider Version

5.59.0

Affected Resource(s)

Updating an instance_type for aws_instance does not always work and sometimes the update-in-place operation fails due to https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/resize-limitations.html

Expected Behavior

When the user initiates a change to the instance_type that cannot succeed, is it possible to either:

Actual Behavior

terraform apply fails after several minutes of retrying

Relevant Error/Panic Output Snippet

ws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m0s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m10s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m20s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m30s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m40s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 1m50s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m0s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m10s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m20s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m30s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m40s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 2m50s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 3m0s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 3m10s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 3m20s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 3m30s elapsed]
aws_instance.web: Still modifying... [id=i-0df0a3de8347c8188, 3m40s elapsed]
╷
│ Error: updating EC2 Instance (i-0df0a3de8347c8188) type: modifying EC2 Instance (i-0df0a3de8347c8188) InstanceType (p4d.24xlarge) attribute: operation error EC2: ModifyInstanceAttribute, https response error StatusCode: 400, RequestID: 6eb9f156-faac-4e82-bf0c-7a9b97718ecd, api error InvalidInstanceAttributeValue: Modifying the instance type from g5.4xlarge to p4d.24xlarge is not allowed.
│ 
│   with aws_instance.web,
│   on infra.tf line 1, in resource "aws_instance" "web":
│    1: resource "aws_instance" "web" {
│ 
╵```

Terraform Configuration Files

resource "aws_instance" "web" {
  ami = "ami-09a13b25443518b29"
  # instance_type = "g5.4xlarge"
  instance_type = "p4d.24xlarge"
}

Steps to Reproduce

Provision "g5.4xlarge" and change to "p4d.24xlarge" and do another terraform apply.

Debug Output

N/A

Panic Output

N/A

Important Factoids

N/A

References

N/A

Would you like to implement a fix?

No

github-actions[bot] commented 4 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue