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 8.99k forks source link

[Bug]: aws_instance instance_market_options: Revert from spot doesn't work #38141

Open getSurreal opened 6 days ago

getSurreal commented 6 days ago

Terraform Core Version

1.5.2

AWS Provider Version

5.55.0

Affected Resource(s)

aws_instance

Expected Behavior

removing the instance_market_options block or setting all the values to null should want to destroy and recreate the instance as non spot.

Actual Behavior

No changes

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

data "aws_ami" "this" {
  most_recent = true
  owners      = ["amazon"]
  filter {
    name   = "architecture"
    values = ["arm64"]
  }
  filter {
    name   = "name"
    values = ["al2023-ami-2023*"]
  }
}

resource "aws_instance" "this" {
  ami = data.aws_ami.this.id
  instance_market_options {
    market_type = "Spot"
  }
  instance_type = "t4g.nano"
  tags = {
    Name = "test-spot"
  }
}

Steps to Reproduce

Remove the instance_market_options

resource "aws_instance" "this" {
  ami = data.aws_ami.this.id

  instance_type = "t4g.nano"
  tags = {
    Name = "test-undo-spot"
  }
}

or set the values to null

resource "aws_instance" "this" {
  ami = data.aws_ami.this.id
  instance_market_options {
    market_type = null
  }
  instance_type = "t4g.nano"
  tags = {
    Name = "test-spot"
  }
}

Debug Output

No response

Panic Output

No response

Important Factoids

Starting with a non spot instance and setting it to spot properly wants to destroy and recreate the resource.

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 6 days ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue