From 60ed8b5f69f0c19d7a33b13b5bbfdee016c0d637 Mon Sep 17 00:00:00 2001 From: Damian Hippisley Date: Wed, 23 Oct 2024 18:17:42 +0100 Subject: [PATCH] Fix Unresolved dependencies [WebInstanceType] --- templates/00-main.yaml | 2 ++ templates/03-pipelinehelper.yaml | 21 +++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/templates/00-main.yaml b/templates/00-main.yaml index c05325b..648c664 100644 --- a/templates/00-main.yaml +++ b/templates/00-main.yaml @@ -887,6 +887,8 @@ Resources: !Ref rdsInstanceSecret DomainName: !Ref DomainName + InstanceType: + !Ref WebInstanceType MoodleLocale: !Ref MoodleLocale ProjectName: diff --git a/templates/03-pipelinehelper.yaml b/templates/03-pipelinehelper.yaml index 71c0ce0..243034a 100644 --- a/templates/03-pipelinehelper.yaml +++ b/templates/03-pipelinehelper.yaml @@ -181,6 +181,17 @@ Parameters: Description: Specifies the TGZ Moodle direct download URL Type: String +Mappings: + InstanceTypeMap: + t4g: { UseGraviton2Ami: "true" } + c6g: { UseGraviton2Ami: "true" } + c7g: { UseGraviton2Ami: "true" } + m6g: { UseGraviton2Ami: "true" } + m7g: { UseGraviton2Ami: "true" } + r6g: { UseGraviton2Ami: "true" } + r7g: { UseGraviton2Ami: "true" } + other: { UseGraviton2Ami: "false" } + Conditions: NumberOfSubnets1: !Equals [ 1, !Ref NumberOfSubnets ] @@ -196,14 +207,8 @@ Conditions: - !Condition NumberOfSubnets2 - !Condition NumberOfSubnets3 Subnet2: !Condition NumberOfSubnets3 - UsingGraviton2Ami: !Or - - !Equals ["t4",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["c6",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["c7",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["m6",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["m7",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["r6",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] - - !Equals ["r7",!Select [0, !Split [ "g.", !Ref WebInstanceType]]] + UsingGraviton2Ami: + !Equals [!FindInMap [InstanceTypeMap, !Select [0, !Split [".", !Ref InstanceType]], UseGraviton2Ami], "true"] Resources: ########################### TODO put this in the codepipeline template