Loading...
Loading...
### Terraform Version ```shell # terraform version Terraform v1.12.2 on linux_amd64 + provider registry.opentofu.org/hashicorp/aws v6.4.0 + provider registry.terraform.io/hashicorp/aws v6.4.0 ``` ### Terraform Configuration Files ```terraform resource "aws_instance" "this" { ami = "resolve:ssm:/aws/service/canonical/ubuntu/server-minimal/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id" instance_type = "t3a.small" subnet_id = data.aws_subnet.main.id associate_public_ip_address = true root_block_device { volume_type = "gp3" volume_size = 10 tags = { "Name" = "root" } } } ...terraform config... ``` ### Debug Output ``` 07:51:23.972 STDOUT terraform: module.ec2_instance.aws_instance.this: Creating... 07:51:25.569 STDERR terraform: ╷ 07:51:25.569 STDERR terraform: │ Error: collecting instance settings: operation error EC2: DescribeImages, https response error StatusCode: 400, RequestID: c4fdfe66-6f8e-4f9e-933e-869698dda468, api error InvalidAMIID.Malformed: Invalid id: "resolve:ssm:/aws/service/canonical/ubuntu/server-minimal/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id" (expecting "ami-...") 07:51:25.569 STDERR terraform: │ 07:51:25.569 STDERR terraform: │ with module.ec2_instance.aws_instance.this, 07:51:25.569 STDERR terraform: │ on ../../../../modules/aws/ec2_instance/1.0/main.tf line 16, in resource "aws_instance" "this": 07:51:25.570 STDERR terraform: │ 16: resource "aws_instance" "this" { 07:51:25.570 STDERR terraform: │ 07:51:25.570 STDERR terraform: ╵ 07:51:25.969 STDOUT terraform: Releasing state lock. This may take a few moments... 07:51:26.103 ERROR terraform invocation failed in . 07:51:26.103 ERROR error occurred: * Failed to execute "terraform apply" in . ╷ │ Error: collecting instance settings: operation error EC2: DescribeImages, https response error StatusCode: 400, RequestID: c4fdfe66-6f8e-4f9e-933e-869698dda468, api error InvalidAMIID.Malformed: Invalid id: "resolve:ssm:/aws/service/canonical/ubuntu/server-minimal/24.04/stable/current/amd64/hvm/ebs-gp3/ami-id" (expecting "ami-...") ``` ### Expected Behavior The ec2 instance should be created, ami should be looked up. This is what happens when there is no root_block_device definition. ### Actual Behavior error is shown saying the ami variable's value has to start with "ami-" ### Steps to Reproduce terraform init terraform apply ### Additional Context When ```terraform root_block_device { volume_type = "gp3" volume_size = 10 tags = { "Name" = "root" } } ...terraform config... ``` is ommited, then terraform apply works as expected. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.