terraform-google-modules / terraform-google-iam

Manages multiple IAM roles for resources on Google Cloud

Home Page:https://registry.terraform.io/modules/terraform-google-modules/iam/google

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The requested URL was not found on this server. <ins>That’s all we know.</ins>

t-v opened this issue · comments

I am trying to apply the folders_iam module, but it keeps failing on retrieving the policy.

What I do:

resource "google_folder" "folder_bootcamp" {
  display_name = "bootcamp"
  parent = "folders/${var.root_folder}"
}

module "folder-iam-bootcamp" {
  source  = "terraform-google-modules/iam/google//modules/folders_iam"
  folders = ["${google_folder.folder_bootcamp.id}"]

  mode = "authoritative"

  bindings = {
    "roles/bigquery.jobUser" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
    "roles/bigquery.user" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
    "roles/cloudsql.editor" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
    "roles/cloudtrace.user" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
    "roles/compute.viewer" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
    "roles/container.viewer" = [
      "group:__it-parts-gcp_squad-scs_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_developer@tvh.com",
      "group:__it-parts-gcp_squad-bootcamp_technical-lead@tvh.com",
    ]
  }
}

But this keeps giving me errors like:

Error: Error retrieving IAM policy for folder "folders/folders/8670795366": googleapi: got HTTP response code 404 with body: <!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>The requested URL <code>/v2/folders/folders/8670795366:getIamPolicy?alt=json&amp;prettyPrint=false</code> was not found on this server.  <ins>That’s all we know.</ins>


  on .terraform/modules/folder-iam-toolbox/terraform-google-modules-terraform-google-iam-45700d3/modules/folders_iam/main.tf line 30, in resource "google_folder_iam_binding" "folder_iam_authoritative":
  30: resource "google_folder_iam_binding" "folder_iam_authoritative" {

my assumption is that the fault lies in the fact it adds folders/ for the id that's given as an argument, which ends up showing: folders/folders/8670795366

Duplicate of #65.