terraform-provider-google icon indicating copy to clipboard operation
terraform-provider-google copied to clipboard

google_redis_instance - auth_string

Open drandell opened this issue 2 years ago • 2 comments

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

Affected Resource(s)

  • google_redis_instance

Terraform Configuration Files

auth_string according to the docs can be populated but its generated by GCP. So this should be output only in the docs. https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/redis_instance

References

  • #0000

drandell avatar Sep 15 '22 09:09 drandell

@drandell I agreed auth_string should be in the exported section. Because this is a specially handled field, currently the code generation tool does not support adding a field like this into the exported section. As this is only for the doc, changing the label to documentation

https://github.com/GoogleCloudPlatform/magic-modules/blob/70352381f79e67152922421649d1b48cdacf8fe9/mmv1/products/redis/terraform.yaml#L18

https://github.com/GoogleCloudPlatform/magic-modules/blob/70352381f79e67152922421649d1b48cdacf8fe9/mmv1/templates/terraform/resource.html.markdown.erb#L156

edwardmedia avatar Sep 17 '22 15:09 edwardmedia

If I get some time this week I might make the PR for this, agree wrong label :)

drandell avatar Sep 17 '22 19:09 drandell

Here is the google_redis_instance documentation from the Argument Reference section :

auth_string - (Optional) AUTH String set on the instance. This field will only be populated if auth_enabled is true.

Then, here I wrote this Terraform code :

resource "google_redis_instance" "main" {
  name               = "memory-cache"
  memory_size_gb     = var.redis_memory
  display_name       = "memory-cache"
  auth_enabled       = "true"
  auth_string        = var.redis_auth
  authorized_network = data.google_compute_network.shared_vpc.id
  connect_mode       = "PRIVATE_SERVICE_ACCESS"
  region             = local.region
  maintenance_policy {
    weekly_maintenance_window {
      day = "TUESDAY"
      start_time {
        hours   = 1
        minutes = 0
      }
    }
  }
  depends_on = [
    google_project_service.memorystore_redis
  ]
}

Finally, this is the error message I encounter :

╷
│ Error: Value for unconfigurable attribute
│
│   with google_redis_instance.main,
│   on redis.tf line 6, in resource "google_redis_instance" "main":
│    6:   auth_string        = var.redis_auth
│
│ Can't configure a value for "auth_string": its value will be decided automatically based on the result of applying this configuration.
╵

Thanks.

jlenuffgsoi avatar Jan 19 '23 14:01 jlenuffgsoi

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[bot] avatar Mar 06 '23 02:03 github-actions[bot]