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.64k stars 9.02k forks source link

get error when run "terraform plan -generate-config-out=generated_resources.tf" on resource "vpc" #37968

Open ozbillwang opened 1 month ago

ozbillwang commented 1 month ago

Description

Terraform Version

terraform version
Terraform v1.8.3
on darwin_amd64
+ provider registry.terraform.io/hashicorp/aws v5.50.0

Terraform Configuration Files

$ cat import.tf

import {
  id = "vpc-81939bxx"  # Resource ID in the cloud
  to = aws_vpc.this# Resource address in OpenTofu configuration
}

Debug Output

$ terraform plan -generate-config-out=generated_resources.tf

aws_vpc.this: Preparing import... [id=vpc-81939bxx]
aws_vpc.this: Refreshing state... [id=vpc-81939bxx]

Planning failed. Terraform encountered an error while generating this plan.

╷
│ Warning: Config generation is experimental
│
│ Generating configuration during import is currently experimental, and the generated configuration format may change in future versions.
╵
╷
│ Error: Missing required argument
│
│   with aws_vpc.this,
│   on generated_resources.tf line 12:
│   (source code not available)
│
│ "ipv6_netmask_length": all of `ipv6_ipam_pool_id,ipv6_netmask_length` must be specified

Expected Behavior

No error

Actual Behavior

get error

╷
│ Error: Missing required argument
│
│   with aws_vpc.this,
│   on generated_resources.tf line 12:
│   (source code not available)
│
│ "ipv6_netmask_length": all of `ipv6_ipam_pool_id,ipv6_netmask_length` must be specified

Steps to Reproduce

$ cat import.tf
import {
  id = "vpc-81939bxx"  # Resource ID in the cloud
  to = aws_vpc.this# Resource address in OpenTofu configuration
}

$ terraform plan -generate-config-out=generated_resources.tf

Additional Context

No response

References

No response

References

https://developer.hashicorp.com/terraform/language/import/generating-configuration

Would you like to implement a fix?

None

ref: https://github.com/hashicorp/terraform/issues/35227#issuecomment-2164961766

github-actions[bot] commented 1 month ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue