hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.18k forks source link

[Bug]: r/aws_redshiftserverless_namespace: unable to remove default IAM role #39268

Open marcinbelczewski opened 2 months ago

marcinbelczewski commented 2 months ago

Terraform Core Version

1.9.5

AWS Provider Version

5.66.0

Affected Resource(s)

Expected Behavior

default IAM role is removed from the namespace. This operation is fully supported by UpdateNamespace API.

Actual Behavior

The following error appears when default_iam_role_arn is removed from resource config:

aws_redshiftserverless_namespace.test: Modifying... [id=test]
╷
│ Error: updating Redshift Serverless Namespace (test): operation error Redshift Serverless: UpdateNamespace, https response error StatusCode: 400, RequestID: cf5a3887-0d24-40e7-ac0d-aad4d5f95e0e, ValidationException: To change the default IAM role, you must specify the entire list of IAM roles.
│
│   with aws_redshiftserverless_namespace.test,
│   on main.tf line 52, in resource "aws_redshiftserverless_namespace" "test":
│   52: resource "aws_redshiftserverless_namespace" "test" {
│

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

resource "aws_iam_role" "test" {
    name = "test"
    assume_role_policy = jsonencode({
        Version = "2012-10-17"
        Statement = [
        {
            Effect = "Allow"
            Principal = {
            Service = "redshift.amazonaws.com"
            }
            Action = "sts:AssumeRole"
        }
        ]
    })
}

resource "aws_redshiftserverless_namespace" "test" {
  namespace_name = "test"
  default_iam_role_arn = aws_iam_role.test.arn
  iam_roles = [aws_iam_role.test.arn]
}

Steps to Reproduce

  1. Apply the configuration above
  2. Remove default_iam_role_arn from the configuration, or set it to "" or null and apply - observe the error

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

Yes

github-actions[bot] commented 2 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue