diff --git a/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx b/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx
index e540476efa..b47c627ec7 100644
--- a/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx
+++ b/ui/components/providers/workflow/forms/select-credentials-type/aws/credentials-type/aws-role-credentials-form.tsx
@@ -1,4 +1,4 @@
-import { Divider, Select, SelectItem, Switch } from "@nextui-org/react";
+import { Chip, Divider, Select, SelectItem, Switch } from "@nextui-org/react";
import { useState } from "react";
import { Control, UseFormSetValue, useWatch } from "react-hook-form";
@@ -24,13 +24,18 @@ export const AWSRoleCredentialsForm = ({
};
type?: "providers" | "s3-integration";
}) => {
- const [showRoleSection, setShowRoleSection] = useState(type === "providers");
-
+ const isCloudEnv = process.env.NEXT_PUBLIC_IS_CLOUD_ENV === "true";
+ const defaultCredentialsType = isCloudEnv
+ ? "aws-sdk-default"
+ : "access-secret-key";
const credentialsType = useWatch({
control,
name: ProviderCredentialFields.CREDENTIALS_TYPE,
- defaultValue: "access-secret-key",
+ defaultValue: defaultCredentialsType,
});
+ const [showOptionalRole, setShowOptionalRole] = useState(false);
+ const showRoleSection =
+ (isCloudEnv && credentialsType === "aws-sdk-default") || showOptionalRole;
return (
<>
@@ -50,7 +55,7 @@ export const AWSRoleCredentialsForm = ({
name={ProviderCredentialFields.CREDENTIALS_TYPE}
label="Authentication Method"
placeholder="Select credentials type"
- defaultSelectedKeys={["access-secret-key"]}
+ defaultSelectedKeys={[defaultCredentialsType]}
className="mb-4"
variant="bordered"
onSelectionChange={(keys) =>
@@ -60,8 +65,32 @@ export const AWSRoleCredentialsForm = ({
)
}
>
-