cf2tf
cf2tf copied to clipboard
Tag conversion issue
Super minor, but for resource tags need some slight tweak to make them generate in the right format.
Input (CloudFormation):
Tags:
- Key: Network
Value: Public
- Key: Name
Value: Production VPC
Output:
tags = [{'Key': '"Network"', 'Value': '"Public"'}, {'Key': '"Name"', 'Value': '"Production VPC"'}]
Should be:
tags = {
Network = "Public"
Name = "Production VPC"
}
Current output errors for tags on terraform plan
:
╷
│ Error: Invalid character
│
│ on vpc.tf line 104, in resource "aws_vpc" "vpc":
│ 104: tags = [{'Key': '"Network"', 'Value': '"Public"'}, {'Key': '"Name"', 'Value': '"Production VPC"'}]
│
│ Single quotes are not valid. Use double quotes (") to enclose strings.
╵
Duplicate of #23 but I will keep this open because this will likely require a different solution.
In version 0.4
we released an override feature https://github.com/DontShaveTheYak/cf2tf/pull/86. This feature is meant to add override behavior for specific resources but I think could be easily adapted to add an override behavior for every resource. That means it should now be pretty simple to reformat the tags property in a way that is compatible with Terraform.