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.61k stars 9k forks source link

[Bug]: EC2 Instance Size Change with Typo Not Reverting to Running State in Terraform AWS #37849

Open Dimopanagos opened 1 month ago

Dimopanagos commented 1 month ago

Terraform Core Version

v1.8.5

AWS Provider Version

v5.52.0

Affected Resource(s)

aws_instance

Expected Behavior

It should revert and Start the server on "Running" state

Actual Behavior

Right now, even if you remove the typo and add the previous working size, the server do not start, its remaining "stopped"

Relevant Error/Panic Output Snippet

│ Error: updating EC2 Instance (i-086443bd9d265611b) type: modifying EC2 Instance (i-086443bd9d265611b) InstanceType (t3.smalle) attribute: InvalidParameterValue: The following supplied instance types do not exist: [t3.smalle]

Terraform Configuration Files

provider "aws" {
  region                   = "us-east-1"
  shared_credentials_files = ["~/.aws/temp_credentials"]
  profile                  = "default"
}

resource "aws_instance" "my_ubuntu" {
  ami           = "ami-04b70fa74e45c3917"
  instance_type = "t3.micro"
  key_name      = "john_mac_os_key_main_key"

  tags = {
    Name    = "My-Ubuntu-Server"
    Owner   = "John"
    Project = "Phoenix"
  }
}

resource "aws_instance" "my_amazon" {
  ami           = "ami-00beae93a2d981137"
  instance_type = "t3.micro"

  tags = {
    Name  = "My-AmazonLinux-Server"
    Owner = "John"
  }
}

Steps to Reproduce

When working with Terraform AWS, if you create an EC2 server and later change its size but make a typographical error, for example, entering "t3.smalle" instead of "t3.small", Terraform does not show an error during the plan phase. However, when you apply the changes, it stops the server and then displays the following error:

│ Error: updating EC2 Instance (i-086443bd9d265611b) type: modifying EC2 Instance (i-086443bd9d265611b) InstanceType (t3.smalle) attribute: InvalidParameterValue: The following supplied instance types do not exist: [t3.smalle] 

The server remains in a stopped state, and even if you revert to the correct size it had before and apply the changes again, the server continues to stay stopped. The only way to make terraform to start the server again, is to put another size that exist, not the previous working one, but some another (new).

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue