diff --git a/dbt/adapters/redshift/connections.py b/dbt/adapters/redshift/connections.py index e46ea5d51..4a85d0021 100644 --- a/dbt/adapters/redshift/connections.py +++ b/dbt/adapters/redshift/connections.py @@ -37,7 +37,7 @@ def get_message(self) -> str: class RedshiftConnectionMethod(StrEnum): DATABASE = "database" IAM = "iam" - IAMR = "iamr" + IAM_ROLE = "iam_role" class UserSSLMode(StrEnum): @@ -215,7 +215,7 @@ def connect(): raise FailedToConnectError("'user' field is required for 'iam' credentials") def connect(): - logger.debug("Connecting to redshift with IAM based auth...") + logger.debug("Connecting to redshift with IAM User based auth...") c = redshift_connector.connect( iam=True, db_user=self.credentials.user, @@ -231,15 +231,18 @@ def connect(): c.cursor().execute("set role {}".format(self.credentials.role)) return c - elif method == RedshiftConnectionMethod.IAMR: + elif method == RedshiftConnectionMethod.IAM_ROLE: if not self.credentials.cluster_id and "serverless" not in self.credentials.host: raise FailedToConnectError( - "Failed to use IAM method. 'cluster_id' must be provided for provisioned cluster. " + "Failed to use IAM Role method. 'cluster_id' must be provided for provisioned cluster. " "'host' must be provided for serverless endpoint." ) + if self.credentials.user is None: + raise FailedToConnectError("'user' field is required for 'iam' credentials") + def connect(): - logger.debug("Connecting to redshift with IAM based auth...") + logger.debug("Connecting to redshift with IAM Role based auth...") c = redshift_connector.connect( iam=True, cluster_identifier=self.credentials.cluster_id, diff --git a/dbt/include/redshift/profile_template.yml b/dbt/include/redshift/profile_template.yml index 5f6b0a91a..d78356923 100644 --- a/dbt/include/redshift/profile_template.yml +++ b/dbt/include/redshift/profile_template.yml @@ -15,8 +15,8 @@ prompts: hide_input: true iam: _fixed_method: iam - iamr: - _fixed_method: iamr + iam_role: + _fixed_method: iam_role dbname: hint: 'default database that dbt will build objects in' schema: