terraform-provider-tfe icon indicating copy to clipboard operation
terraform-provider-tfe copied to clipboard

Manage workspace access declaratively

Open eriksw opened this issue 4 years ago • 5 comments

The tfe_team_access allows managing the access of a single team, but there is currently no way to declaratively manage all access to a workspace.

Proposal:

Add a resource, perhaps tfe_workspace_access with repeatable blocks define all the team access grants for a workspace. When this resource is applied, any existing grants that are not defined as part of the resource get removed.

Using this would be mutually exclusive use of tfe_team_access, akin to google_project_iam_policy vs google_project_iam_member.

eriksw avatar Sep 09 '20 00:09 eriksw

Ohu, this is a nasty issue... Hope to see a fix soonish...

iniinikoski avatar Feb 04 '21 19:02 iniinikoski

Note that sadly there is no direct platform equivalent of Google IAM policies in Terraform Cloud/Enterprise, only direct connections to teams (like Google IAM members). I believe this would require a feature in TFC itself or an argument to r/tfe_workspace directly to declare relationships to teams, and likely not it's own resource (like an IAM policy).

chrisarcand avatar Feb 07 '21 02:02 chrisarcand

Thank you for the explanation @chrisarcand.

@eriksw have you found a workaround for this...?

iniinikoski avatar Apr 23 '21 12:04 iniinikoski

The only possible workaround would be some awful exec resource to run a script that removes undesired access.

Because this is kind of an essential function (preventing ACL drift), it makes more sense for this provider to implement it on top of whatever APIs do exist, instead of forcing users to independently cobble together some anti-drift auditing/enforcement on their own.

I don't care whether it's by moving access into tfe_workspace or by adding a new resource.

eriksw avatar Apr 23 '21 14:04 eriksw

The odd-related flip side of this is there is no data source to look up all the teams that currently have access to a workspace. You have to already know each team and each workspace ID to use the tfe_team_access data source which seems very limited. Being able to output all the current team access for a particular workspace would be quite helpful.

devopsrick avatar Aug 24 '21 07:08 devopsrick