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

service_accounts_iam doesn't work with computed values #232

Open
red8888 opened this issue Nov 8, 2024 · 1 comment
Open

service_accounts_iam doesn't work with computed values #232

red8888 opened this issue Nov 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@red8888
Copy link

red8888 commented Nov 8, 2024

TL;DR

You already fixed this here: https://github.com/terraform-google-modules/terraform-google-iam/issues/75\

You need to apply the same fix to this module

Expected behavior

Works with computed values

Observed behavior

│ 50: for_each = module.helper.set_additive
│ ├────────────────
│ │ module.helper.set_additive is a set of dynamic, known only after apply

│ The "for_each" set includes values derived from resource attributes that cannot be determined until apply, and so Terraform cannot determine the full set of keys that will identify the instances of
│ this resource.

Terraform Configuration

module "my_acct" {
  source           = "terraform-google-modules/iam/google//modules/service_accounts_iam"
  service_accounts = [data.google_service_account.my_acct.email]
  project          = var.project_id
  mode             = "additive"
  bindings = {
    "roles/iam.serviceAccountTokenCreator" = [
      "serviceAccount:${google_service_account.aaaa.email}",
    ]
    "roles/iam.serviceAccountUser" = [
      "serviceAccount:${google_service_account.aaaa.email}",
    ]
  }
}

Terraform Version

Terraform v1.9.5
on darwin_arm64
+ provider registry.terraform.io/hashicorp/google v6.10.0
+ provider registry.terraform.io/hashicorp/google-beta v6.10.0

Additional information

No response

@red8888 red8888 added the bug Something isn't working label Nov 8, 2024
@zope
Copy link

zope commented Dec 24, 2024

I faced the same issue and couldn’t use the service_accounts_iam module.

So, I opted to use google_service_account_iam_member directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants