Sfoglia il codice sorgente

Fix null ARN in pre-provision check from infra settings (#2841)

Feroze Mohideen 3 anni fa
parent
commit
60d319f2fc

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

@@ -21,20 +21,17 @@ import Link from "./porter/Link";
 
 type Props = {
   goBack: () => void;
-  AWSAccountID: string;
-  setAWSAccountID: (id: string) => void;
   proceed: (id: string) => void;
 };
 
 const CloudFormationForm: React.FC<Props> = ({
   goBack,
   proceed,
-  AWSAccountID,
-  setAWSAccountID
 }) => {
   const [grantPermissionsError, setGrantPermissionsError] = useState("");
   const [roleStatus, setRoleStatus] = useState("");
   const [errorMessage, setErrorMessage] = useState(undefined);
+  const [AWSAccountID, setAWSAccountID] = useState("");
   const { currentProject } = useContext(Context);
 
   const getExternalId = () => {

+ 1 - 3
dashboard/src/components/CredentialsForm.tsx

@@ -21,7 +21,7 @@ import Spacer from "./porter/Spacer";
 
 type Props = {
   goBack: () => void;
-  proceed: (x: any) => void;
+  proceed: (cloud_provider_credentials_id: string) => void;
   enableAssumeRole?: () => void;
 };
 
@@ -80,10 +80,8 @@ const CredentialsForm: React.FC<Props> = ({
           // Hardcoded for backward-compatibility
           // TODO: remove
           aws_region: "us-east-f",
-
           aws_access_key_id: awsAccessKeyID,
           aws_secret_access_key: awsSecretAccessKey,
-          aws_assume_role_arn: "",
         },
         {
           id: currentProject.id,

+ 0 - 4
dashboard/src/components/ProvisionerFlow.tsx

@@ -30,7 +30,6 @@ const ProvisionerFlow: React.FC<Props> = ({
   const [credentialId, setCredentialId] = useState("");
   const [showCostConfirmModal, setShowCostConfirmModal] = useState(false);
   const [confirmCost, setConfirmCost] = useState("");
-  const [AWSAccountID, setAWSAccountID] = useState("");
   const [useAssumeRole, setUseAssumeRole] = useState(false);
 
   const isUsageExceeded = useMemo(() => {
@@ -162,8 +161,6 @@ const ProvisionerFlow: React.FC<Props> = ({
           setCredentialId(id);
           setCurrentStep("cluster");
         }}
-        AWSAccountID={AWSAccountID}
-        setAWSAccountID={setAWSAccountID}
       />
     );
   } else if (currentStep === "credentials" && !useAssumeRole) {
@@ -182,7 +179,6 @@ const ProvisionerFlow: React.FC<Props> = ({
       <ProvisionerForm
         goBack={() => setCurrentStep("credentials")}
         credentialId={credentialId}
-        AWSAccountID={AWSAccountID}
         useAssumeRole={useAssumeRole}
       />
     );

+ 1 - 3
dashboard/src/components/ProvisionerForm.tsx

@@ -13,14 +13,12 @@ import Spacer from "./porter/Spacer";
 type Props = {
   goBack: () => void;
   credentialId: string;
-  AWSAccountID: string;
   useAssumeRole?: boolean;
 };
 
 const ProvisionerForm: React.FC<Props> = ({
   goBack,
   credentialId,
-  AWSAccountID,
   useAssumeRole,
 }) => {
   return (
@@ -40,7 +38,7 @@ const ProvisionerForm: React.FC<Props> = ({
       </Text>
       <Spacer y={1} />
       {useAssumeRole ? (
-        <ProvisionerSettings credentialId={credentialId} AWSAccountID={AWSAccountID} />
+        <ProvisionerSettings credentialId={credentialId} />
       ) : (
         <ProvisionerSettingsOld credentialId={credentialId} />
       )}

+ 1 - 2
dashboard/src/components/ProvisionerSettings.tsx

@@ -56,7 +56,6 @@ const clusterVersionOptions = [
 type Props = RouteComponentProps & {
   selectedClusterVersion?: Contract;
   credentialId: string;
-  AWSAccountID?: string;
   clusterId?: number;
 };
 
@@ -148,7 +147,7 @@ const ProvisionerSettings: React.FC<Props> = props => {
         .preflightCheckAWSUsage(
           "<token>",
           {
-            target_arn: `arn:aws:iam::${props.AWSAccountID}:role/porter-role`,
+            target_arn: props.credentialId,
             region: awsRegion
           },
           {