diff --git a/integration/combination/test_function_with_capacity_provider.py b/integration/combination/test_function_with_capacity_provider.py index 836c54018..cdf6436e5 100644 --- a/integration/combination/test_function_with_capacity_provider.py +++ b/integration/combination/test_function_with_capacity_provider.py @@ -138,6 +138,22 @@ def test_function_with_capacity_provider_default_role(self): self.verify_capacity_provider_vpc_config(simple_cp_config, "SimpleCapacityProvider") self.verify_capacity_provider_permissions_config(simple_cp_config, "SimpleCapacityProvider") + # Verify Globals.CapacityProvider.ManagedResourceTags inheritance on SimpleCapacityProvider + simple_propagate_tags = simple_cp_config.get("PropagateTags") + self.assertIsNotNone(simple_propagate_tags, "SimpleCapacityProvider should inherit PropagateTags from Globals") + self.assertEqual( + simple_propagate_tags.get("Mode"), + "Explicit", + "SimpleCapacityProvider should have PropagateTags Mode: Explicit from Globals", + ) + simple_explicit_tags = simple_propagate_tags.get("ExplicitTags", {}) + self.assertIn("GlobalTag", simple_explicit_tags, "SimpleCapacityProvider should inherit GlobalTag from Globals") + self.assertEqual( + simple_explicit_tags["GlobalTag"], + "shared-value", + "GlobalTag should be 'shared-value' from Globals", + ) + advanced_cp_config = self.get_lambda_capacity_provider_config("AdvancedCapacityProvider") self.verify_capacity_provider_basic_config(advanced_cp_config, "AdvancedCapacityProvider") self.verify_capacity_provider_vpc_config(advanced_cp_config, "AdvancedCapacityProvider") @@ -180,6 +196,23 @@ def test_function_with_capacity_provider_default_role(self): "AdvancedCapacityProvider should use the correct KMS key", ) + # Verify ManagedResourceTags -> PropagateTags configuration + propagate_tags = advanced_cp_config.get("PropagateTags") + self.assertIsNotNone(propagate_tags, "AdvancedCapacityProvider should have PropagateTags configuration") + self.assertEqual( + propagate_tags.get("Mode"), "Explicit", "AdvancedCapacityProvider should have PropagateTags Mode: Explicit" + ) + + explicit_tags = propagate_tags.get("ExplicitTags", {}) + self.assertIn("Environment", explicit_tags, "AdvancedCapacityProvider should propagate Environment tag") + self.assertIn("Team", explicit_tags, "AdvancedCapacityProvider should propagate Team tag") + self.assertIn("GlobalTag", explicit_tags, "AdvancedCapacityProvider should override GlobalTag from Globals") + self.assertEqual(explicit_tags["Environment"], "Production", "Environment tag should be 'Production'") + self.assertEqual(explicit_tags["Team"], "Lambda-Tooling", "Team tag should be 'Lambda-Tooling'") + self.assertEqual( + explicit_tags["GlobalTag"], "overridden-value", "GlobalTag should be overridden by resource-level value" + ) + telemetry_config = advanced_cp_config.get("TelemetryConfig") self.assertIsNotNone(telemetry_config, "AdvancedCapacityProvider should have TelemetryConfig") logging_config = telemetry_config.get("LoggingConfig") diff --git a/integration/resources/templates/combination/function_lmi_default.yaml b/integration/resources/templates/combination/function_lmi_default.yaml index 36dfcfc94..27dfc51e8 100644 --- a/integration/resources/templates/combination/function_lmi_default.yaml +++ b/integration/resources/templates/combination/function_lmi_default.yaml @@ -6,6 +6,12 @@ Parameters: KMSKeyArn: Type: String +Globals: + CapacityProvider: + ManagedResourceTags: + Tags: + GlobalTag: shared-value + Resources: SimpleCapacityProvider: Type: AWS::Serverless::CapacityProvider @@ -45,6 +51,11 @@ Resources: KmsKeyArn: !Ref KMSKeyArn LoggingConfig: SystemLogLevel: DEBUG + ManagedResourceTags: + Tags: + Environment: Production + Team: Lambda-Tooling + GlobalTag: overridden-value Tags: Environment: Test diff --git a/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py b/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py index 0b482e2a0..accf8b4da 100644 --- a/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py +++ b/samtranslator/internal/schema_source/aws_serverless_capacity_provider.py @@ -27,7 +27,6 @@ class ManagedResourceTags(BaseModel): Tags: DictStrAny | None = managedresourcetags("Tags") - Propagate: bool | None = managedresourcetags("Propagate") class VpcConfig(BaseModel): diff --git a/samtranslator/internal/schema_source/sam-docs.json b/samtranslator/internal/schema_source/sam-docs.json index 30f81c3b8..f1629137b 100644 --- a/samtranslator/internal/schema_source/sam-docs.json +++ b/samtranslator/internal/schema_source/sam-docs.json @@ -121,7 +121,6 @@ "ExcludedTypes": "A list of EC2 instance types to exclude from the capacity provider. \n*Type*: List \n*Required*: No \n*CloudFormation compatibility*: This property is passed directly to the [`ExcludedInstanceTypes`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lambda-capacityprovider-instancerequirements.html#cfn-lambda-capacityprovider-instancerequirements-excludedinstancetypes) property of [`InstanceRequirements`](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-capacityprovider.html#cfn-lambda-capacityprovider-instancerequirements) of an `AWS::Lambda::CapacityProvider` resource." }, "sam-property-capacityprovider-managedresourcetags": { - "Propagate": "TODO", "Tags": "TODO" }, "sam-property-capacityprovider-scalingconfig": { diff --git a/samtranslator/model/capacity_provider/generators.py b/samtranslator/model/capacity_provider/generators.py index 5c6fa688d..846a37f01 100644 --- a/samtranslator/model/capacity_provider/generators.py +++ b/samtranslator/model/capacity_provider/generators.py @@ -235,7 +235,4 @@ def _transform_managed_resource_tags(self) -> dict[str, Any]: if "Tags" in tags: return {"Mode": "Explicit", "ExplicitTags": get_tag_list(tags["Tags"])} - if "Propagate" in tags: - return {"Mode": "CapacityProvider" if tags["Propagate"] else "None"} - return {} diff --git a/samtranslator/model/sam_resources.py b/samtranslator/model/sam_resources.py index f9bcdd76b..09145282d 100644 --- a/samtranslator/model/sam_resources.py +++ b/samtranslator/model/sam_resources.py @@ -1577,10 +1577,6 @@ class SamCapacityProvider(SamResourceMacro): ValidationRule.MUTUALLY_EXCLUSIVE, ["InstanceRequirements.AllowedTypes", "InstanceRequirements.ExcludedTypes"], ), - ( - ValidationRule.MUTUALLY_EXCLUSIVE, - ["ManagedResourceTags.Propagate=True", "ManagedResourceTags.Tags"], - ), ] def to_cloudformation(self, **kwargs: Any) -> list[Resource]: diff --git a/samtranslator/schema/schema.json b/samtranslator/schema/schema.json index abd2b0c6b..c95c309ea 100644 --- a/samtranslator/schema/schema.json +++ b/samtranslator/schema/schema.json @@ -374761,11 +374761,6 @@ "ManagedResourceTags": { "additionalProperties": false, "properties": { - "Propagate": { - "markdownDescription": "TODO", - "title": "Propagate", - "type": "boolean" - }, "Tags": { "markdownDescription": "TODO", "title": "Tags", diff --git a/samtranslator/yaml_helper.py b/samtranslator/yaml_helper.py index 60f0e4f16..8a20e7fab 100644 --- a/samtranslator/yaml_helper.py +++ b/samtranslator/yaml_helper.py @@ -7,7 +7,7 @@ def yaml_parse(yamlstr): # type: ignore[no-untyped-def] """Parse a yaml string""" - yaml.SafeLoader.add_multi_constructor("!", intrinsics_multi_constructor) # type: ignore[no-untyped-call] + yaml.SafeLoader.add_multi_constructor("!", intrinsics_multi_constructor) # type: ignore[no-untyped-call,unused-ignore] return yaml.safe_load(yamlstr) diff --git a/schema_source/sam.schema.json b/schema_source/sam.schema.json index 1ced46489..cc1b29f7a 100644 --- a/schema_source/sam.schema.json +++ b/schema_source/sam.schema.json @@ -3065,11 +3065,6 @@ "ManagedResourceTags": { "additionalProperties": false, "properties": { - "Propagate": { - "markdownDescription": "TODO", - "title": "Propagate", - "type": "boolean" - }, "Tags": { "markdownDescription": "TODO", "title": "Tags", diff --git a/tests/model/capacity_provider/test_generators.py b/tests/model/capacity_provider/test_generators.py index c9b52f48d..ea487d4f6 100644 --- a/tests/model/capacity_provider/test_generators.py +++ b/tests/model/capacity_provider/test_generators.py @@ -226,8 +226,6 @@ def extract_resource(self, resource_array: list[Resource]): @parameterized.expand( [ - ("propagate_true", {"Propagate": True}, {"Mode": "CapacityProvider"}), - ("propagate_false", {"Propagate": False}, {"Mode": "None"}), ( "explicit_tags", {"Tags": {"Env": "prod", "Team": "tooling"}}, @@ -251,9 +249,12 @@ def test_to_cloudformation_with_managed_resource_tags(self): self.logical_id, vpc_config=self.vpc_config, operator_role=self.operator_role, - managed_resource_tags={"Propagate": True}, + managed_resource_tags={"Tags": {"Env": "prod"}}, ) resources = generator.to_cloudformation() resource_dict = self.extract_resource(resources) capacity_provider = resource_dict[self.logical_id] - self.assertEqual(capacity_provider["Properties"]["PropagateTags"], {"Mode": "CapacityProvider"}) + self.assertEqual( + capacity_provider["Properties"]["PropagateTags"], + {"Mode": "Explicit", "ExplicitTags": [{"Key": "Env", "Value": "prod"}]}, + ) diff --git a/tests/translator/input/capacity_provider_managed_resource_tags.yaml b/tests/translator/input/capacity_provider_managed_resource_tags.yaml index 54b29f967..a448fba34 100644 --- a/tests/translator/input/capacity_provider_managed_resource_tags.yaml +++ b/tests/translator/input/capacity_provider_managed_resource_tags.yaml @@ -1,6 +1,6 @@ AWSTemplateFormatVersion: '2010-09-09' Transform: AWS::Serverless-2016-10-31 -Description: Test ManagedResourceTags - all configurations +Description: Test ManagedResourceTags - explicit tags configuration Parameters: Environment: @@ -10,7 +10,8 @@ Parameters: Globals: CapacityProvider: ManagedResourceTags: - Propagate: true + Tags: + GlobalTag: shared-value Resources: CpInheritsGlobal: @@ -22,7 +23,7 @@ Resources: SecurityGroupIds: - sg-11111111 - CpOverridePropagateFalse: + CpOverrideWithExplicitTags: Type: AWS::Serverless::CapacityProvider Properties: VpcConfig: @@ -31,31 +32,6 @@ Resources: SecurityGroupIds: - sg-22222222 ManagedResourceTags: - Propagate: false - - CpOverrideWithExplicitTags: - Type: AWS::Serverless::CapacityProvider - Properties: - VpcConfig: - SubnetIds: - - subnet-33333333 - SecurityGroupIds: - - sg-33333333 - ManagedResourceTags: - Propagate: false Tags: Environment: !Ref Environment Team: !Sub '${AWS::StackName}-tooling' - - # PRUNE_AND_MERGE: local has only Tags → global Propagate key is dropped - CpOverrideStrategyDropsGlobalKey: - Type: AWS::Serverless::CapacityProvider - Properties: - VpcConfig: - SubnetIds: - - subnet-44444444 - SecurityGroupIds: - - sg-44444444 - ManagedResourceTags: - Tags: - App: my-service diff --git a/tests/translator/input/error_capacity_provider_managed_resource_tags_intrinsic_propagate.yaml b/tests/translator/input/error_capacity_provider_managed_resource_tags_intrinsic_propagate.yaml deleted file mode 100644 index d9defb795..000000000 --- a/tests/translator/input/error_capacity_provider_managed_resource_tags_intrinsic_propagate.yaml +++ /dev/null @@ -1,20 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: AWS::Serverless-2016-10-31 -Description: Test ManagedResourceTags.Propagate rejects intrinsic functions - -Parameters: - EnablePropagation: - Type: String - Default: 'true' - -Resources: - CpPropagateWithRef: - Type: AWS::Serverless::CapacityProvider - Properties: - VpcConfig: - SubnetIds: - - subnet-12345678 - SecurityGroupIds: - - sg-12345678 - ManagedResourceTags: - Propagate: !Ref EnablePropagation diff --git a/tests/translator/input/error_capacity_provider_managed_resource_tags_mutual_exclusion.yaml b/tests/translator/input/error_capacity_provider_managed_resource_tags_mutual_exclusion.yaml deleted file mode 100644 index 59c9f3f72..000000000 --- a/tests/translator/input/error_capacity_provider_managed_resource_tags_mutual_exclusion.yaml +++ /dev/null @@ -1,20 +0,0 @@ -AWSTemplateFormatVersion: '2010-09-09' -Transform: AWS::Serverless-2016-10-31 -Description: Test ManagedResourceTags mutual exclusion error - -Globals: - CapacityProvider: - ManagedResourceTags: - Propagate: true - -Resources: - CpBothSet: - Type: AWS::Serverless::CapacityProvider - Properties: - VpcConfig: - SubnetIds: - - subnet-12345678 - ManagedResourceTags: - Propagate: true - Tags: - Environment: Production diff --git a/tests/translator/output/aws-cn/capacity_provider_managed_resource_tags.json b/tests/translator/output/aws-cn/capacity_provider_managed_resource_tags.json index ce336beb5..a9fc0e87f 100644 --- a/tests/translator/output/aws-cn/capacity_provider_managed_resource_tags.json +++ b/tests/translator/output/aws-cn/capacity_provider_managed_resource_tags.json @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion": "2010-09-09", - "Description": "Test ManagedResourceTags - all configurations", + "Description": "Test ManagedResourceTags - explicit tags configuration", "Parameters": { "Environment": { "Default": "Production", @@ -18,131 +18,11 @@ ] } }, - "PropagateTags": { - "Mode": "CapacityProvider" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-11111111" - ], - "SubnetIds": [ - "subnet-11111111" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpInheritsGlobalOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws-cn:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverridePropagateFalse": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverridePropagateFalseOperatorRole", - "Arn" - ] - } - }, - "PropagateTags": { - "Mode": "None" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-22222222" - ], - "SubnetIds": [ - "subnet-22222222" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpOverridePropagateFalseOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws-cn:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverrideStrategyDropsGlobalKey": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverrideStrategyDropsGlobalKeyOperatorRole", - "Arn" - ] - } - }, "PropagateTags": { "ExplicitTags": [ { - "Key": "App", - "Value": "my-service" + "Key": "GlobalTag", + "Value": "shared-value" } ], "Mode": "Explicit" @@ -155,16 +35,16 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-44444444" + "sg-11111111" ], "SubnetIds": [ - "subnet-44444444" + "subnet-11111111" ] } }, "Type": "AWS::Lambda::CapacityProvider" }, - "CpOverrideStrategyDropsGlobalKeyOperatorRole": { + "CpInheritsGlobalOperatorRole": { "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -206,6 +86,10 @@ }, "PropagateTags": { "ExplicitTags": [ + { + "Key": "GlobalTag", + "Value": "shared-value" + }, { "Key": "Environment", "Value": { @@ -229,10 +113,10 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-33333333" + "sg-22222222" ], "SubnetIds": [ - "subnet-33333333" + "subnet-22222222" ] } }, diff --git a/tests/translator/output/aws-us-gov/capacity_provider_managed_resource_tags.json b/tests/translator/output/aws-us-gov/capacity_provider_managed_resource_tags.json index 2b77e9947..4a7e7984a 100644 --- a/tests/translator/output/aws-us-gov/capacity_provider_managed_resource_tags.json +++ b/tests/translator/output/aws-us-gov/capacity_provider_managed_resource_tags.json @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion": "2010-09-09", - "Description": "Test ManagedResourceTags - all configurations", + "Description": "Test ManagedResourceTags - explicit tags configuration", "Parameters": { "Environment": { "Default": "Production", @@ -18,131 +18,11 @@ ] } }, - "PropagateTags": { - "Mode": "CapacityProvider" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-11111111" - ], - "SubnetIds": [ - "subnet-11111111" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpInheritsGlobalOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws-us-gov:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverridePropagateFalse": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverridePropagateFalseOperatorRole", - "Arn" - ] - } - }, - "PropagateTags": { - "Mode": "None" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-22222222" - ], - "SubnetIds": [ - "subnet-22222222" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpOverridePropagateFalseOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws-us-gov:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverrideStrategyDropsGlobalKey": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverrideStrategyDropsGlobalKeyOperatorRole", - "Arn" - ] - } - }, "PropagateTags": { "ExplicitTags": [ { - "Key": "App", - "Value": "my-service" + "Key": "GlobalTag", + "Value": "shared-value" } ], "Mode": "Explicit" @@ -155,16 +35,16 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-44444444" + "sg-11111111" ], "SubnetIds": [ - "subnet-44444444" + "subnet-11111111" ] } }, "Type": "AWS::Lambda::CapacityProvider" }, - "CpOverrideStrategyDropsGlobalKeyOperatorRole": { + "CpInheritsGlobalOperatorRole": { "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -206,6 +86,10 @@ }, "PropagateTags": { "ExplicitTags": [ + { + "Key": "GlobalTag", + "Value": "shared-value" + }, { "Key": "Environment", "Value": { @@ -229,10 +113,10 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-33333333" + "sg-22222222" ], "SubnetIds": [ - "subnet-33333333" + "subnet-22222222" ] } }, diff --git a/tests/translator/output/capacity_provider_managed_resource_tags.json b/tests/translator/output/capacity_provider_managed_resource_tags.json index c4cbd291b..e474800aa 100644 --- a/tests/translator/output/capacity_provider_managed_resource_tags.json +++ b/tests/translator/output/capacity_provider_managed_resource_tags.json @@ -1,6 +1,6 @@ { "AWSTemplateFormatVersion": "2010-09-09", - "Description": "Test ManagedResourceTags - all configurations", + "Description": "Test ManagedResourceTags - explicit tags configuration", "Parameters": { "Environment": { "Default": "Production", @@ -18,131 +18,11 @@ ] } }, - "PropagateTags": { - "Mode": "CapacityProvider" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-11111111" - ], - "SubnetIds": [ - "subnet-11111111" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpInheritsGlobalOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverridePropagateFalse": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverridePropagateFalseOperatorRole", - "Arn" - ] - } - }, - "PropagateTags": { - "Mode": "None" - }, - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ], - "VpcConfig": { - "SecurityGroupIds": [ - "sg-22222222" - ], - "SubnetIds": [ - "subnet-22222222" - ] - } - }, - "Type": "AWS::Lambda::CapacityProvider" - }, - "CpOverridePropagateFalseOperatorRole": { - "Properties": { - "AssumeRolePolicyDocument": { - "Statement": [ - { - "Action": [ - "sts:AssumeRole" - ], - "Effect": "Allow", - "Principal": { - "Service": [ - "lambda.amazonaws.com" - ] - } - } - ], - "Version": "2012-10-17" - }, - "ManagedPolicyArns": [ - "arn:aws:iam::aws:policy/AWSLambdaManagedEC2ResourceOperator" - ], - "Tags": [ - { - "Key": "lambda:createdBy", - "Value": "SAM" - } - ] - }, - "Type": "AWS::IAM::Role" - }, - "CpOverrideStrategyDropsGlobalKey": { - "Properties": { - "PermissionsConfig": { - "CapacityProviderOperatorRoleArn": { - "Fn::GetAtt": [ - "CpOverrideStrategyDropsGlobalKeyOperatorRole", - "Arn" - ] - } - }, "PropagateTags": { "ExplicitTags": [ { - "Key": "App", - "Value": "my-service" + "Key": "GlobalTag", + "Value": "shared-value" } ], "Mode": "Explicit" @@ -155,16 +35,16 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-44444444" + "sg-11111111" ], "SubnetIds": [ - "subnet-44444444" + "subnet-11111111" ] } }, "Type": "AWS::Lambda::CapacityProvider" }, - "CpOverrideStrategyDropsGlobalKeyOperatorRole": { + "CpInheritsGlobalOperatorRole": { "Properties": { "AssumeRolePolicyDocument": { "Statement": [ @@ -206,6 +86,10 @@ }, "PropagateTags": { "ExplicitTags": [ + { + "Key": "GlobalTag", + "Value": "shared-value" + }, { "Key": "Environment", "Value": { @@ -229,10 +113,10 @@ ], "VpcConfig": { "SecurityGroupIds": [ - "sg-33333333" + "sg-22222222" ], "SubnetIds": [ - "subnet-33333333" + "subnet-22222222" ] } }, diff --git a/tests/translator/output/error_capacity_provider_managed_resource_tags_intrinsic_propagate.json b/tests/translator/output/error_capacity_provider_managed_resource_tags_intrinsic_propagate.json deleted file mode 100644 index 2ca1bf9b9..000000000 --- a/tests/translator/output/error_capacity_provider_managed_resource_tags_intrinsic_propagate.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "_autoGeneratedBreakdownErrorMessage": [ - "Invalid Serverless Application Specification document. ", - "Number of errors found: 1. ", - "Resource with id [CpPropagateWithRef] is invalid. ", - "Property 'ManagedResourceTags.Propagate' value could not be parsed to a boolean." - ], - "errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [CpPropagateWithRef] is invalid. Property 'ManagedResourceTags.Propagate' value could not be parsed to a boolean." -} diff --git a/tests/translator/output/error_capacity_provider_managed_resource_tags_mutual_exclusion.json b/tests/translator/output/error_capacity_provider_managed_resource_tags_mutual_exclusion.json deleted file mode 100644 index 235b125bd..000000000 --- a/tests/translator/output/error_capacity_provider_managed_resource_tags_mutual_exclusion.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "_autoGeneratedBreakdownErrorMessage": [ - "Invalid Serverless Application Specification document. ", - "Number of errors found: 1. ", - "Resource with id [CpBothSet] is invalid. ", - "Cannot specify 'ManagedResourceTags.Propagate=True' and 'ManagedResourceTags.Tags' together." - ], - "errorMessage": "Invalid Serverless Application Specification document. Number of errors found: 1. Resource with id [CpBothSet] is invalid. Cannot specify 'ManagedResourceTags.Propagate=True' and 'ManagedResourceTags.Tags' together." -}