From 95437fe167c51d0f773770fff259acc42cc5c742 Mon Sep 17 00:00:00 2001 From: jetaba Date: Thu, 30 May 2024 10:47:00 -0500 Subject: [PATCH] tweaks --- cloudformation/bc_core.yaml | 6 +++--- cloudformation/bc_ecs_task_role.yaml | 14 ++++++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/cloudformation/bc_core.yaml b/cloudformation/bc_core.yaml index d64d937..bb3882e 100644 --- a/cloudformation/bc_core.yaml +++ b/cloudformation/bc_core.yaml @@ -763,8 +763,8 @@ Resources: Type: AWS::Serverless::Application Properties: Location: bc_ecs_task_role.yaml - Parameters: - RoleName: !Sub "${AWS::StackName}-EcsTaskRole-${AWS::Region}" +# Parameters: +# RoleName: !Sub "${AWS::StackName}-EcsTaskRole-${AWS::Region}" # todo: keep this around a while longer, because deleting it will break every workflow in the account EcsTaskRole: @@ -772,7 +772,7 @@ Resources: DeletionPolicy: Retain Properties: Description: !Sub | - DEPRECATED: Use !Sub ${EcsTaskRoleStack.Outputs.EcsTaskRoleArn} instead. + DEPRECATED: Use ${EcsTaskRoleStack.Outputs.EcsTaskRoleArn} instead. AssumeRolePolicyDocument: Version: "2012-10-17" Statement: diff --git a/cloudformation/bc_ecs_task_role.yaml b/cloudformation/bc_ecs_task_role.yaml index 3dbfde8..a66ab2a 100644 --- a/cloudformation/bc_ecs_task_role.yaml +++ b/cloudformation/bc_ecs_task_role.yaml @@ -5,16 +5,24 @@ Parameters: Type: String Default: "default" + PolicyName: + Type: String + Default: "default" + Conditions: UseDefaultRoleName: !Or [ !Equals [!Ref RoleName, "Default"], !Equals [!Ref RoleName, "default"] ] + UseDefaultPolicyName: !Or [ !Equals [!Ref PolicyName, "Default"], + !Equals [!Ref PolicyName, "default"] ] + Resources: EcsTaskRole: Type: AWS::IAM::Role Properties: RoleName: - !If [UseDefaultRoleName, !Sub "${AWS::StackName}-${AWS::Region}", !Ref RoleName] + !If [UseDefaultRoleName, !Ref AWS::NoValue, !Ref RoleName] +# !If [UseDefaultRoleName, !Sub "${AWS::StackName}-${AWS::Region}", !Ref RoleName] AssumeRolePolicyDocument: Version: "2012-10-17" Statement: @@ -28,7 +36,9 @@ Resources: EcsTaskPolicy: Type: AWS::IAM::ManagedPolicy Properties: - ManagedPolicyName: !Sub "${EcsTaskRole}-policy" + ManagedPolicyName: + !If [UseDefaultPolicyName, !Ref AWS::NoValue, !Ref PolicyName] +# ManagedPolicyName: !Sub "${EcsTaskRole}-policy" Roles: - !Ref EcsTaskRole PolicyDocument: