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

When I run the terraformer command in my python script for ec2 instance, I am unable to generate the terraform.tfstate file #1874

Closed
kavya922 opened this issue May 1, 2024 · 2 comments

Comments

@kavya922
Copy link

kavya922 commented May 1, 2024

Terraform Version
Terraformer v0.8.24
Terraform Configuration Files
subprocess.run(["terraformer", "import", "aws", "--resources", service, "--regions", region], capture_output=True, shell=True)

Debug Output
CompletedProcess(args=['terraformer', 'import', 'aws', '--resources', 'ec2', '--regions', 'us-east-1'], returncode=0, stdout=b'2024/05/01 13:54:48 aws importing region us-east-1\n2024/05/01 13:54:57 aws importing... ec2\n2024/05/01 13:54:57 aws error importing ec2, err: aws: ec2 not supported service\n2024/05/01 13:54:57 aws Connecting.... \n', stderr=b'')

Expected Behavior
Should generate the terraform.tfstate file for ec2 instance

Actual Behavior
CompletedProcess(args=['terraformer', 'import', 'aws', '--resources', 'ec2', '--regions', 'us-east-1'], returncode=0, stdout=b'2024/05/01 13:54:48 aws importing region us-east-1\n2024/05/01 13:54:57 aws importing... ec2\n2024/05/01 13:54:57 aws error importing ec2, err: aws: ec2 not supported service\n2024/05/01 13:54:57 aws Connecting.... \n', stderr=b'')

Steps to Reproduce
terraform init
subprocess.run(["terraformer", "import", "aws", "--resources", service, "--regions", region], capture_output=True, shell=True)
Additional Context
This is the python command I am using to run the terraformer command for ec2 instance
subprocess.run(["terraformer", "import", "aws", "--resources", service, "--regions", region], capture_output=True, shell=True)

And the error I am getting is
CompletedProcess(args=['terraformer', 'import', 'aws', '--resources', 'ec2', '--regions', 'us-east-1'], returncode=0, stdout=b'2024/05/01 13:54:48 aws importing region us-east-1\n2024/05/01 13:54:57 aws importing... ec2\n2024/05/01 13:54:57 aws error importing ec2, err: aws: ec2 not supported service\n2024/05/01 13:54:57 aws Connecting.... \n', stderr=b'')

I do not understand why it throwing an error : ec2 as a not supported service

The version of terraformer i am using is = Terraformer v0.8.24

Any help is greatly appreciated

Thank you in advance

@samuel-casey
Copy link

I had this issue too. You need to use ec2_instance instead of just ec2 as the argument for resources.

The list of aws resource names that terraformer accepts can be found here.

@kavya922
Copy link
Author

kavya922 commented May 2, 2024

@samuel-casey Thanks a lot ! It worked !

@kavya922 kavya922 closed this as completed May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants