Skip to content

Breaking change in 4.1.1 - Attribute iam_emails returns full service account id / name instead of account_id #59

@philippeboyd

Description

@philippeboyd

TL;DR

Attribute iam_emails returns full service account id / name instead of account_id (same with return attribute emails)

Expected behavior

> module.service_accounts.iam_emails
{
  "first" = "serviceAccount:prefix-first@<project_id>.iam.gserviceaccount.com"
  "second" = "serviceAccount:prefix-second@<project_id>.iam.gserviceaccount.com"
}

Observed behavior

> module.service_accounts.iam_emails
{
  "projects/<project_id>/serviceAccounts/prefix-first@<project_id>.iam.gserviceaccount.com" = "serviceAccount:prefix-first@<project_id>.iam.gserviceaccount.com"
  "projects/<project_id>/serviceAccounts/prefix-second@<project_id>.iam.gserviceaccount.com" = "serviceAccount:prefix-second@<project_id>.iam.gserviceaccount.com"
}

Terraform Configuration

module "service_accounts" {
  source        = "terraform-google-modules/service-accounts/google"
  version       = "4.1.1"
  project_id    = "<project_id>"
  prefix        = "prefix"
  names         = ["first", "second"]
}

Terraform Version

Terraform v1.1.6
on darwin_amd64
+ provider registry.terraform.io/hashicorp/google v4.11.0
+ provider registry.terraform.io/hashicorp/google-beta v4.11.0
+ provider registry.terraform.io/hashicorp/null v3.1.0
+ provider registry.terraform.io/hashicorp/random v3.1.0
+ provider registry.terraform.io/hashicorp/time v0.7.2

Additional information

Related to PR #57

Version 4.1.0 was convenient in the following use case:

module "service_accounts" {
  source        = "terraform-google-modules/service-accounts/google"
  version       = "4.1.0"
  project_id    = "<project_id>"
  prefix        = "prefix"
  names         = ["first", "second"]
}

module "buckets" {
  source  = "terraform-google-modules/cloud-storage/google"
  version = "~> 3.1"

  project_id = <project_id>
  location   = "northamerica-northeast1"
  prefix     = ""
  names = [
    "bucket-first",
    "bucket-second",
  ]

  set_viewer_roles = true
  bucket_viewers = {
    "bucket-first" = module.service_accounts.iam_emails["first"], # <- no longer works since key `first` doesn't exist
    "bucket-second" = module.service_accounts.iam_emails["second"], # <- no longer works since key `second` doesn't exist
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagedScoped and ready for work

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions