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

google_bigtable_table_iam_member - 404 error #9496

Closed
drandell opened this issue Jul 2, 2021 · 3 comments
Closed

google_bigtable_table_iam_member - 404 error #9496

drandell opened this issue Jul 2, 2021 · 3 comments
Assignees
Labels

Comments

@drandell
Copy link
Contributor

drandell commented Jul 2, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

Terraform v0.15.3

  • provider registry.terraform.io/hashicorp/google v3.73.0
  • provider registry.terraform.io/hashicorp/google-beta v3.73.0

Affected Resource(s)

  • google_bigtable_table_iam_member

Terraform Configuration Files

resource "google_bigtable_instance" "instance" {
  name    = "${var.bigtable_prefix}-instance"
  project = var.project_id

  cluster {
    cluster_id   = "${var.bigtable_prefix}-cluster"
    num_nodes    = var.bigtable_nodes
    zone               = var.zone
    storage_type = var.bigtable_storage_type
  }

  labels = {
    data_label = "cluster"
  }

  lifecycle {
    prevent_destroy = true
  }
}

resource "google_bigtable_table" "fdal_raw_tables" {
  for_each      = toset(var.raw_tables_list)
  name           = each.key
  instance_name = google_bigtable_instance.instance.name
  project       = var.project_id

  column_family {
    family = var.column_name
  }

  lifecycle {
    prevent_destroy = true
  }
}

resource "google_bigtable_gc_policy" "gc_policy_raw_tables" {
  project       = var.project_id
  for_each      = toset(var.raw_tables_list)
  instance_name = google_bigtable_instance.fdal_instance.name
  table         = each.key
  column_family = var.column_name

  max_age {
    duration = var.ttl_rows
  }
  depends_on = [google_bigtable_table.raw_tables]
}

resource "google_service_account" "bigtable_app_sa" {
  project      = var.project_id
  account_id   = "${var.bigtable_prefix}-bigtable-app-sa"
  display_name = "BigTable access service account for apps"
}

resource "google_bigtable_table_iam_member" "bigtable_app_sa_access_raw_tables" {
  project  = var.project_id
  for_each = google_bigtable_table.fdal_raw_tables

  table      = each.value.name
  instance   = google_bigtable_instance.instance.id
  role       = "roles/bigtable.user"
  member     = "serviceAccount:${google_service_account.bigtable_app_sa.email}"
  depends_on = [
    google_service_account.bigtable_app_sa
  ]
}

Debug Output

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/projects/[project_id]/instances/projects/[project_id]/instances/[instance_name]/tables/[table_name]:setIamPolicy?alt=json&amp;prettyPrint=false</code> was not found on this server.  <ins>That’s all we know.</ins>
│
│
│   with module.bigtable.google_bigtable_table_iam_policy.bigtable_app_sa_access_raw_tables,
│   on bigtable\main.tf line 78, in resource "google_bigtable_table_iam_policy" "bigtable_app_sa_access_raw_tables":
│   78: resource "google_bigtable_table_iam_policy" "bigtable_app_sa_access_raw_tables" {

Expected Behavior

I should assign the role 'bigtable.user' to the instance

Actual Behavior

I get a 404 google api error.

Steps to Reproduce

  1. terraform apply

Important Factoids

@drandell drandell added the bug label Jul 2, 2021
@venkykuberan venkykuberan self-assigned this Jul 2, 2021
@venkykuberan
Copy link
Contributor

Your requested URL - <code>/v2/projects/[project_id]/instances/projects/[project_id]/instances/[instance_name]/tables/[table_name]:setIamPolicy?alt=json&amp;prettyPrint=false seems wrong.

In google_bigtable_table_iam_member resource using instance name instead of id should work as the resource takes name attribute.

@drandell
Copy link
Contributor Author

drandell commented Jul 2, 2021

Edit two:

Sorry I mis-understood,

instance - (Required) The name or relative resource id of the instance that owns the table.

This wasn't all that clear, but yes it does work using just name and not id. (IMO it should support either)

@github-actions
Copy link

github-actions bot commented Aug 2, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants