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

New sample requests: Create an IAM service account and grant it a role #754

Open
shannonxtreme opened this issue Nov 4, 2024 · 0 comments

Comments

@shannonxtreme
Copy link

shannonxtreme commented Nov 4, 2024

TL;DR

Add two new samples (or one sample with 2 region tags) for creating an IAM service account and then granting it a role on a resource. For example, creating a new service account for GKE nodes to use, then granting it the roles/container.defaultNodeServiceAccount role on the project.

Terraform Resources

  1. Create a new IAM service account in a project (https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account)
  2. Grant a role on a resource (https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/google_service_account_iam#google_service_account_iam_binding)

Detailed design

For the sample, make the following values in variable syntax (all caps, underscore-delimited):

  1. Role to grant: ROLE
  2. Service account account_id value: SERVICE_ACCOUNT_ID
  3. Service account display_name value: DISPLAY_NAME
  4. Resource to grant the role on (in the terraform docs example I think it's "admin-account-iam"? ROLE_RESOURCE

For the IAM binding's member field, I think we can use serviceAccount:${google_service_account.sa.email}

Additional information

No response

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

No branches or pull requests

1 participant