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.77k stars 9.12k forks source link

[Bug]:The instance of the mac dedicated host created by terraform cannot be started properly. #31421

Open chinfeng2github opened 1 year ago

chinfeng2github commented 1 year ago

Terraform Core Version

v1.4.0

AWS Provider Version

v4.67.0

Affected Resource(s)

aws_ec2_host & aws_instance

Expected Behavior

The instance can be started normally on the mac dedicated host created by terraform

Actual Behavior

The instance of the mac dedicated host created by terraform cannot be started properly. The instance status check always fails, so the mac instance cannot be used normally. However, when I create a dedicated host on the console and use the hostid of the dedicated host to create an instance in terraform, it can be used normally

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

  1. allocate mac dedicated host

    resource "aws_ec2_host" "mac_host" {
      count         = var.create_host == false ? 0 : 1
      instance_type = var.inst_type
      availability_zone = var.host_availability_zone
      host_recovery     = "off"
      # auto_placement    = "on"
      auto_placement = "off"
    
      tags = {
        Name        = "${var.inst_type}-host"
        Environment = "Prod"
      }
    }
  2. apply aws ec2 instance

    module "aws_proxy_server" {
    ...
      host_id             = var.create_host == false ? var.host_id : aws_ec2_host.mac_host[0].id

Steps to Reproduce

Using the above configuration, apply normally

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

chinfeng2github commented 1 year ago

inst_type = "mac1.metal"