driftctl/pkg/resource/aws/aws_route_table_association.go

31 lines
1.1 KiB
Go
Raw Normal View History

2021-01-18 14:27:31 +00:00
package aws
2021-05-21 14:09:45 +00:00
import "github.com/cloudskiff/driftctl/pkg/resource"
2021-03-25 11:13:52 +00:00
2021-01-18 14:27:31 +00:00
const AwsRouteTableAssociationResourceType = "aws_route_table_association"
2021-05-21 14:09:45 +00:00
func initAwsRouteTableAssociationMetaData(resourceSchemaRepository resource.SchemaRepositoryInterface) {
2021-08-09 15:15:35 +00:00
resourceSchemaRepository.SetResolveReadAttributesFunc(AwsRouteTableAssociationResourceType, func(res *resource.Resource) map[string]string {
return map[string]string{
"route_table_id": *res.Attributes().GetString("route_table_id"),
}
})
2021-08-09 14:03:04 +00:00
resourceSchemaRepository.SetHumanReadableAttributesFunc(AwsRouteTableAssociationResourceType, func(res *resource.Resource) map[string]string {
2021-05-21 14:09:45 +00:00
val := res.Attrs
attrs := make(map[string]string)
if rtID := val.GetString("route_table_id"); rtID != nil && *rtID != "" {
attrs["Table"] = *rtID
}
if gtwID := val.GetString("gateway_id"); gtwID != nil && *gtwID != "" {
attrs["Gateway"] = *gtwID
}
if subnetID := val.GetString("subnet_id"); subnetID != nil && *subnetID != "" {
attrs["Subnet"] = *subnetID
}
return attrs
})
2021-09-17 15:16:06 +00:00
resourceSchemaRepository.SetFlags(AwsRouteTableAssociationResourceType, resource.FlagDeepMode)
2021-03-25 11:13:52 +00:00
}