diff --git a/smithy-aws-cloudformation/src/main/java/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/CfnConverter.java b/smithy-aws-cloudformation/src/main/java/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/CfnConverter.java index c6c79e352b7..bf99887250e 100644 --- a/smithy-aws-cloudformation/src/main/java/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/CfnConverter.java +++ b/smithy-aws-cloudformation/src/main/java/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/CfnConverter.java @@ -311,7 +311,7 @@ private ResourceSchema convertResource(ConversionEnvironment environment, Resour Tagging.Builder tagBuilder = Tagging.builder() .taggable(true) .tagOnCreate(tagsIndex.isResourceTagOnCreate(resourceShape.getId())) - .tagProperty(getTagsProperty(resourceShape)) + .tagProperty("/properties/" + getTagMemberName(resourceShape)) .cloudFormationSystemTags(!trait.getDisableSystemTags()) // Unless tag-on-create is supported, Smithy tagging means .tagUpdatable(true); @@ -396,7 +396,7 @@ private StructureShape getCfnResourceStructure(Model model, ResourceShape resour return builder.build(); } - private String getTagsProperty(ResourceShape resource) { + private String getTagMemberName(ResourceShape resource) { return resource.getTrait(TaggableTrait.class) .flatMap(TaggableTrait::getProperty) .map(property -> { @@ -414,7 +414,7 @@ private void injectTagsIfNecessary( ResourceShape resource, CfnResource cfnResource ) { - String tagPropertyName = getTagsProperty(resource); + String tagMemberName = getTagMemberName(resource); if (resource.hasTrait(TaggableTrait.class)) { AwsTagIndex tagIndex = AwsTagIndex.of(model); TaggableTrait trait = resource.expectTrait(TaggableTrait.class); @@ -422,13 +422,13 @@ private void injectTagsIfNecessary( .containsKey(trait.getProperty().get())) { if (trait.getProperty().isPresent()) { ShapeId definition = resource.getProperties().get(trait.getProperty().get()); - builder.addMember(tagPropertyName, definition); + builder.addMember(tagMemberName, definition); } else { // A valid TagResource operation certainly has a single tags input member. AwsTagIndex awsTagIndex = AwsTagIndex.of(model); Optional tagOperation = tagIndex.getTagResourceOperation(resource.getId()); MemberShape member = awsTagIndex.getTagsMember(tagOperation.get()).get(); - member = member.toBuilder().id(builder.getId().withMember(tagPropertyName)).build(); + member = member.toBuilder().id(builder.getId().withMember(tagMemberName)).build(); builder.addMember(member); } } diff --git a/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather-service-wide.cfn.json b/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather-service-wide.cfn.json index 15d71ee7966..7a9311de52f 100644 --- a/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather-service-wide.cfn.json +++ b/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather-service-wide.cfn.json @@ -80,7 +80,7 @@ }, "tagging": { "tagOnCreate": false, - "tagProperty": "Tags", + "tagProperty": "/properties/Tags", "tagUpdatable": true, "cloudFormationSystemTags": true, "taggable": true diff --git a/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather.cfn.json b/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather.cfn.json index f011c04cfec..7dd4df0905d 100644 --- a/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather.cfn.json +++ b/smithy-aws-cloudformation/src/test/resources/software/amazon/smithy/aws/cloudformation/schema/fromsmithy/weather.cfn.json @@ -79,7 +79,7 @@ }, "tagging": { "tagOnCreate": false, - "tagProperty": "Tags", + "tagProperty": "/properties/Tags", "tagUpdatable": true, "cloudFormationSystemTags": true, "taggable": true