diff --git a/cloudformation/cfncluster.cfn.json b/cloudformation/cfncluster.cfn.json index 44681bdb9c..2e1aa29853 100644 --- a/cloudformation/cfncluster.cfn.json +++ b/cloudformation/cfncluster.cfn.json @@ -1964,30 +1964,23 @@ "Properties": { "Path": "/", "Roles": [ - { - "Ref": "RootRole" - } + {"Fn::If": [ + "UseEC2IAMRole", + { + "Ref": "EC2IAMRoleName" + }, + { + "Ref": "RootRole" + } + ]} ] }, - "Condition": "CreateEC2IAMRole", "Metadata": { "AWS::CloudFormation::Designer": { "id": "2522b048-2b7c-44ed-9d35-6cc66069ca5b" } } - }, - "NewInstanceProfile": { - "Type": "AWS::IAM::InstanceProfile", - "Properties": { - "Path": "/", - "Roles": [ - { - "Ref": "EC2IAMRoleName" - } - ] - }, - "Condition": "UseEC2IAMRole" - }, + }, "CfnClusterPolicies": { "Type": "AWS::IAM::Policy", "Properties": { @@ -2435,17 +2428,7 @@ false ] }, - "IamInstanceProfile": { - "Fn::If": [ - "UseEC2IAMRole", - { - "Ref": "NewInstanceProfile" - }, - { - "Ref": "RootInstanceProfile" - } - ] - }, + "IamInstanceProfile": {"Ref": "RootInstanceProfile"}, "PlacementGroupName": { "Fn::If": [ "UseClusterPlacement", @@ -3009,17 +2992,7 @@ "KeyName": { "Ref": "KeyName" }, - "IamInstanceProfile": { - "Fn::If": [ - "UseEC2IAMRole", - { - "Ref": "NewInstanceProfile" - }, - { - "Ref": "RootInstanceProfile" - } - ] - }, + "IamInstanceProfile": {"Ref": "RootInstanceProfile"}, "SpotPrice": { "Fn::If": [ "UseSpotInstances",