Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ozbillwang opened this issue May 22, 2024 · 4 comments
Labels
bug import Importing resources new new issue not yet triaged provider/aws question

Comments

@ozbillwang
Copy link

ozbillwang commented May 22, 2024

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

@ozbillwang ozbillwang added bug new new issue not yet triaged labels May 22, 2024
@robgifford
Copy link

I'm getting the same error. Running TF 1.8.4, vpc version=v5.51.0

@crw crw added the import Importing resources label Jun 3, 2024
@DanielMSchmidt
Copy link
Collaborator

DanielMSchmidt commented Jun 13, 2024

Hi there,

The problem seems to be that the AWS Provider does not include all necessary attributes on resource read. These are then transformed by terraform's config driven import feature to generate the necessary HCL.

I'll move this issue over to the AWS provider 👍

Edit: Seems like I don't have the right permissions to do that, I'll search for someone 🔎

@ozbillwang
Copy link
Author

Thanks, if you can't move, I can close this and raise a new one in AWS provider repo

@crw
Copy link
Collaborator

crw commented Jun 13, 2024

Hi @ozbillwang, opening a new issue would be easiest. We used to transfer issues but with the modern state of GitHub Action workflows etc, it makes it a lot messier (tagging gets especially screwed up). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug import Importing resources new new issue not yet triaged provider/aws question
Projects
None yet
Development

No branches or pull requests

4 participants