Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Return user's groups as a Terraform data source for templates #8560

Closed
Assignees
f0ssel
@bpmct

Description

@bpmct

There may be cases where a template wants to be aware of the user's groups for infrastructure to provision/tags to add, etc.

The easiest way to do it seems like sending them as an array of strings inhttps://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace

data.coder_workspace.me.owner_groups# ["devops", "platform-engineering", "backstage"]

Use cases

User must be indevops group for this to be provisioned as a part of their workspace:

resource"special_resource""for_devops" {count=contains(data.coder_workspace.me.owner_groups,"devops")?1:0}

Add groups as a tag to an resource:

resource"aws_instance""example" {tags={    Name= data.coder_workspace.me.name    OwnerGroups=join(",", data.coder_workspace.me.owner_groups)  }}

Look up IAM policy based on groups:

data"aws_iam_policy""dynamic" {count=length(data.coder_workspace.me.owner_groups)arn="arn:aws:iam::aws:policy/${element(data.coder_workspace.me.owner_groups, count.index)}"}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp