# Terraform Google provider default\_labels issue

**URL:** <https://discuss.hashicorp.com/t/terraform-google-provider-default-labels-issue/60778>\
**Category:** HCP Terraform\
**Tags:** hcp-terraform\
**Created:** [December 11, 2023, 9:29am UTC](https://discuss.hashicorp.com/t/terraform-google-provider-default-labels-issue/60778 "2023-12-11T09:29:21Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sourangshu.kundu](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@sourangshu.kundu](https://discuss.hashicorp.com/u/sourangshu.kundu)\
**Post date:** [December 11, 2023, 9:29am UTC](https://discuss.hashicorp.com/t/terraform-google-provider-default-labels-issue/60778/1 "2023-12-11T09:29:21Z")

</div>

Hi,

I am trying to manage the labels consistency using default\_labels for google provider. But how can I use a default\_labels value inside resource block to create a resource from the tag value.  
eg. in my providers.tf I have mentioned like this:

```auto
provider "google" {
  project = "my-project"
  region = "us-central1"

  default_labels = {
    managed_by = "Terraform"
    app-env = "dev"
    workspace-name = var.TFC_WORKSPACE_NAME
  }
}

```

Now Suppose I have some user defined labels in my locals.tf.

```auto
user_labels = {
   app_name = "google_pubsub_topic"
}

```

How can I merge them in my pubsub resource.

```auto
resource "google_pubsub_topic" "topic" {
  name = "my_pubsub_topic"
  labels = merge(provider.default_labels, local.user_labels) # is this possible?
...
}

```

Also how can I validate if the some lifecycle precondition or postconditions that the value provided in default\_labels inside provider declaration is valid or not. How to reference the value ?
