Skip to content

Commit

Permalink
Add PrefixList TF support #355
Browse files Browse the repository at this point in the history
  • Loading branch information
iann0036 committed Jan 16, 2024
1 parent c05d18e commit 86c1154
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions js/services/vpc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6282,17 +6282,38 @@ service_mapping_functions.push(function(reqParams, obj, tracked_resources){
});
} else if (obj.type == "ec2.prefixlist") {
reqParams.cfn['AddressFamily'] = obj.data.AddressFamily;
reqParams.tf['address_family'] = obj.data.AddressFamily;
reqParams.cfn['PrefixListName'] = obj.data.PrefixListName;
reqParams.tf['name'] = obj.data.PrefixListName;
reqParams.cfn['MaxEntries'] = obj.data.MaxEntries;
reqParams.tf['max_entries'] = obj.data.MaxEntries;
reqParams.cfn['Tags'] = stripAWSTags(obj.data.Tags);
if (obj.data.Tags) {
reqParams.tf['tags'] = new Map();
obj.data.Tags.forEach(tag => {
if (!tag.Key.startsWith("aws:")) {
reqParams.tf['tags'].set(tag['Key'], tag['Value']);
}
});
}
reqParams.cfn['Entries'] = obj.data.Entries;
if (obj.data.Entries) {
reqParams.tf['entry'] = [];
for (var entry of obj.data.Entries) {
reqParams.tf['entry'].push({
'cidr': entry.Cidr,
'description': entry.Description
});
}
}

tracked_resources.push({
'obj': obj,
'logicalId': getResourceName('ec2', obj.id, 'AWS::EC2::PrefixList'),
'region': obj.region,
'service': 'ec2',
'type': 'AWS::EC2::PrefixList',
'terraformType': 'aws_ec2_managed_prefix_list',
'options': reqParams,
'returnValues': {
'Ref': obj.data.PrefixListId,
Expand All @@ -6303,6 +6324,10 @@ service_mapping_functions.push(function(reqParams, obj, tracked_resources){
},
'Import': {
'PrefixListId': obj.data.PrefixListId
},
'Terraform': {
'arn': obj.data.PrefixListArn,
'id': obj.data.PrefixListId
}
}
});
Expand Down

0 comments on commit 86c1154

Please sign in to comment.