Open marce1990 opened 1 month ago
Hi @marce1990 could you provide your configuration where you are passing in the tag value? tagValues/test
seems like a potentially invalid value. It should be using the numeric generated name from this computed field https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/tags_tag_value#name
Hi @bharathkkb thanks for the answer, if I use the resources provided by terraform: resource "google_tags_tag_key" + resource "google_tags_tag_value" I'm sure it will work.
What I'm trying to use is the tag option in the module "terraform-google-modules/project-factory/google", that if I'm not wrong there is an example of how to use it here: https://github.com/terraform-google-modules/terraform-google-project-factory/blob/master/examples/tags_project/README.md#project-with-tags
The problem is when I replicate what I see in the main.tf example: https://github.com/terraform-google-modules/terraform-google-project-factory/blob/master/examples/tags_project/main.tf
I'm suppose to add this line to the module:
module "project-factory" {
source = "terraform-google-modules/project-factory/google"
version = "~> 15.0"
random_project_id = true
name = "simple-tag-project"
org_id = var.organization_id
folder_id = var.folder_id
billing_account = var.billing_account
default_service_account = "deprivilege"
tag_binding_values = [var.tag_value]
}
But when I do this, is not working, whatever you write in the tag_value variable, that is supposed to be a string value:
variable "tag_value" {
description = "value"
type = string
}
I just copy and paste here:
Once you perform a terraform plan this is how it looks like:
And then when you launch the terraform apply (in this case I wrote "testvalue" but same error):
So maybe I'm not doing it right and I should provide a different input to the tag variable, but I tried many and none of them are working.
TL;DR
When adding the variable "tag_binding_values" a list of strings (example - ["test"]) is returning an error: Error: Error creating TagBinding: googleapi: Error 400: com.google.apps.framework.request.StatusException: generic::INVALID_ARGUMENT: Invalid CRM resource name
Expected behavior
Expected behavior is to create the tags to the project but is returning an error, maybe is not documented how to use it properly
Observed behavior
module.avm-project.module.project-factory.google_tags_tag_binding.bindings["test"]: Creating... ╷ │ Error: Error creating TagBinding: googleapi: Error 400: com.google.apps.framework.request.StatusException: generic::INVALID_ARGUMENT: Invalid CRM resource name: 'tagValues/test'.
│
│ with module.avm-project.module.project-factory.google_tags_tag_binding.bindings["test"],
│ on .terraform/modules/avm-project/modules/core_project_factory/main.tf line 386, in resource "google_tags_tag_binding" "bindings":
│ 386: resource "google_tags_tag_binding" "bindings" {
Terraform Configuration
Terraform Version
Additional information
No response