iann0036 / former2

Generate CloudFormation / Terraform / Troposphere templates from your existing AWS resources.
https://former2.com
MIT License
2.2k stars 266 forks source link

Fully support import of VPC Internet Gateways. #232

Open BigDataDaddy opened 2 years ago

BigDataDaddy commented 2 years ago

I'm trying to import a reverse engineer a VPC that includes an IGW and I'm getting the following error message: Non-compatible Resource: <redacted_VPC_id><redacted_IGW_id> (AWS::EC2::VPCGatewayAttachment). This resource will not be imported.

When I check the repo file former2/RESOURCE_COVERAGE.md I see that the resources AWS::EC2::EgressOnlyInternetGateway and AWS::EC2::InternetGateway are supported, but the resource AWS::EC2::VPCGatewayAttachment is not supported. Also looking at the repo file former2/util/importable.txt I see the following IGW resources appear importable:

AWS::EC2::EgressOnlyInternetGateway ('Id', '', '', '')
AWS::EC2::InternetGateway ('InternetGatewayId', '', '', '')

So, from the contents of those 2 files I'm concluding that VPC IGW Attachments are not yet importable.

Would it be possible to support VPC IGW Attachments so that reverse engineering and importing a working VPC without any errors would be possible?

Note: I'm not 100% convinced this resource needs to be imported because I've created VPCs with IGWs before and don't recall an explicit attach step. However, looking at the CLI I see there are explicit calls for attach-internet-gateway and detach-internet-gateway plus the call for create-internet-gateway it explicitly says "After creating the internet gateway, you attach it to a VPC using AttachInternetGateway ."

Thanks!

iann0036 commented 2 years ago

Hey @BigDataDaddy,

Unfortunately, the resource isn't supported for import by CloudFormation itself as per these docs, so Former2 can't do anything to help as CloudFormation simply won't allow it (even if you tried this yourself manually).