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.83k stars 9.18k forks source link

[Bug]: security_groups and source_destination_check not read on aws_spot_request #27480

Open trunkyredstone opened 2 years ago

trunkyredstone commented 2 years ago

Terraform Core Version

1.2.0

AWS Provider Version

4.36.1

Affected Resource(s)

aws_spot_instance_request

Expected Behavior

No changes should happen on the resource

Actual Behavior

The resource is marked as missing a security group as well as the source destination check being set to true, so it is changed - which causes a reapply. The source destination check is never actually applied

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_spot_instance_request" "nat_gateway" {
  ami                            = "ami-xxxx"
  instance_type                  = "t4g.nano"
  instance_interruption_behavior = "terminate"
  disable_api_termination        = true
  source_destination_check = false

  subnet_id            = xxxx
  security_groups      = [aws_security_group.some_sg.id]

  wait_for_fulfillment = true
}

Steps to Reproduce

Deploy the above resource (security group not supplied), and set the source destination check to false. On apply, the security groups will be reapplied and source destination check set to true again.

Debug Output

https://ass.atomicvr.co.uk/FkFsYDrk4c5k

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

No

github-actions[bot] commented 2 years ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

trunkyredstone commented 2 years ago

Update: I have an idea for a possible fix. Setting up a go environment to try it out

trunkyredstone commented 2 years ago

Identified that this issue links to 6416. Terraform reads the set securityy groups as vpc_security_group_ids, leaving security_groups blank, forcing a replacement.

trunkyredstone commented 2 years ago

Possible that this behaviour is as intended?

github-actions[bot] commented 4 weeks ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!