Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Cannot assign to team the same role but with different workspace ids #179

Open
KarolGongola opened this issue Dec 11, 2024 · 2 comments

Comments

@KarolGongola
Copy link

Description

We cannot create team with e.g. WORKSPACE_OWNER of 2 different workspaces. Example:

resource "astro_team" "admin_team" {
  name              = "team"
  description       = "team description"
  member_ids        = ["SOME_ID"]
  organization_role = "ORGANIZATION_MEMBER"
  workspace_roles = [
  {
    workspace_id = "ID_1"
    role         = "WORKSPACE_OWNER"
  },
  {
    workspace_id = "ID_2"
    role         = "WORKSPACE_OWNER"
  }
  ]
}

Because terraform raises following error:

│ Error: Invalid Configuration: Cannot have multiple roles with the same workspace id
│
│   with astro_team.admin_team,
│   on astro.tf line 27, in resource "astro_team" "admin_team":
│   27: resource "astro_team" "admin_team" {
│
│ Please provide a unique workspace id for each role. The following workspace ids are duplicated: []

So the error message sounds reasonable, but it is not true in my situation. The same I have observed for WORKSPACE_VIEWER as well.

Steps To Reproduce

Try to create team as shown above.

Acceptance Criteria

  • ability to assign one team as WORKSPACE_OWNER to more than one workspace

Anything else?

No response

@KarolGongola
Copy link
Author

I think errors comes from this lines of code, but I have no idea how it it possible:

	duplicateWorkspaceIds := common.GetDuplicateWorkspaceIds(workspaceRoles)
	if len(duplicateWorkspaceIds) > 0 {
		resp.Diagnostics.AddError(
			"Invalid Configuration: Cannot have multiple roles with the same workspace id",
			fmt.Sprintf("Please provide a unique workspace id for each role. The following workspace ids are duplicated: %v", duplicateWorkspaceIds),
		)
		return
	}

@KarolGongola
Copy link
Author

I am using following versions:

Terraform v1.9.5
on linux_amd64
+ provider registry.terraform.io/astronomer/astro v1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant