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: Using skip_iam_grants with use_existing_service_account doesn't work #94

Open
vjosafusha opened this issue May 29, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@vjosafusha
Copy link

vjosafusha commented May 29, 2024

Using skip_iam_grants to skip custom role creation with use_existing_service_account fails. In my terraform configuration, I create a service account, assign the already created custom role with proper permissions. I set the service account name and private key to the module.

bigquery.datasets.get
compute.projects.get
pubsub.topics.get
storage.buckets.get
compute.sslPolicies.get

Module reference:

module "gcp_project_level_config" {
  source                       = "lacework/config/gcp"
  version                      = "~> 3.0"
  project_id                   = var.project_id
  required_config_apis         = {} // apis already enabled
  use_existing_service_account = true
  skip_iam_grants              = true
  service_account_name         = google_service_account.lacework_gcp_compliance_config.name
  service_account_private_key  = google_service_account_key.lacework_sa_compliance_key.private_key
}

I get the following error:
image

Expected behavior
The errors indicate that the module is still trying to assign custom role permission even though the skip_iam_grants is true and I use an existing service account. I am expecting that this step in

role = google_project_iam_custom_role.lacework_custom_project_role.0.name
would be skipped.

On line #L127 of main.tf, you're missing a condition that checks if skip_iam_grants is true, similar to the check for creating the custom role #L118. The expected behavior is that we don't assign a custom role if we have already created it and assigned it to an already created SA.

Please complete the following information):

  • Terraform Version: "~> 1.8.0"
  • Module Version "~> 3.0"
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

1 participant