瀏覽代碼

check aws_ack_auth_enabled for CF stack (#4099)

Stefan McShane 2 年之前
父節點
當前提交
2bb636f123
共有 2 個文件被更改,包括 5 次插入1 次删除
  1. 4 1
      dashboard/src/components/CloudFormationForm.tsx
  2. 1 0
      dashboard/src/shared/types.tsx

+ 4 - 1
dashboard/src/components/CloudFormationForm.tsx

@@ -222,7 +222,10 @@ const CloudFormationForm: React.FC<Props> = ({
     setCurrentStep(3)
     setCurrentStep(3)
     const externalId = getExternalId();
     const externalId = getExternalId();
     let trustArn = process.env.TRUST_ARN ? process.env.TRUST_ARN : "arn:aws:iam::108458755588:role/CAPIManagement";
     let trustArn = process.env.TRUST_ARN ? process.env.TRUST_ARN : "arn:aws:iam::108458755588:role/CAPIManagement";
-    const cloudformation_url = `https://console.aws.amazon.com/cloudformation/home?#/stacks/create/review?templateURL=https://porter-role.s3.us-east-2.amazonaws.com/cloudformation-policy.json&stackName=PorterRole&param_ExternalIdParameter=${externalId}&param_TrustArnParameter=${trustArn}`
+    let cloudformation_url = `https://console.aws.amazon.com/cloudformation/home?#/stacks/create/review?templateURL=https://porter-role.s3.us-east-2.amazonaws.com/cloudformation-policy.json&stackName=PorterRole&param_ExternalIdParameter=${externalId}&param_TrustArnParameter=${trustArn}`
+    if (currentProject.aws_ack_auth_enabled === true) {
+      cloudformation_url = `https://console.aws.amazon.com/cloudformation/home?#/stacks/create/review?templateURL=https://porter-role.s3.us-east-2.amazonaws.com/cloudformation-access-policy.json&stackName=PorterRole&param_TrustArnParameter=${trustArn}`
+    }
     markStepStarted({ step: "aws-cloudformation-redirect-success", account_id: AWSAccountID, cloudformation_url, external_id: externalId })
     markStepStarted({ step: "aws-cloudformation-redirect-success", account_id: AWSAccountID, cloudformation_url, external_id: externalId })
     window.open(cloudformation_url, "_blank")
     window.open(cloudformation_url, "_blank")
     setHasClickedCloudformationButton(true);
     setHasClickedCloudformationButton(true);

+ 1 - 0
dashboard/src/shared/types.tsx

@@ -293,6 +293,7 @@ export type ProjectType = {
   stacks_enabled: boolean;
   stacks_enabled: boolean;
   validate_apply_v2: boolean;
   validate_apply_v2: boolean;
   managed_deployment_targets_enabled: boolean;
   managed_deployment_targets_enabled: boolean;
+  aws_ack_auth_enabled: boolean;
   roles: Array<{
   roles: Array<{
     id: number;
     id: number;
     kind: string;
     kind: string;