title: Terraform: Merge/Re-push Tags into the Source Module
body: <p>New to Terraform::
  We have a community module for SQS that most of the developers use to spin up a SQS queue and it comes with few(4) tags (community does not have a re-usable Tags module right now).
  For my project I need to have extra tags for my SQS queue than the community SQS has, caveat here is that they just did not allow us to make changes in their module.
  And I have a tags module that I wrote which I want to use it along with the community SQS module.
  Long story short I want to override entire tags block in community SQS module below with my tags module</p>
  <ul>
  <li>use the community module as is and add extra terraform to &quot;re-push&quot; tags</li>
  </ul>
  <p>Community SQS Module (named as main.tf):-</p>
  <pre><code>  resource &quot;aws_sqs_queue&quot; &quot;new_terraform_queue&quot; {
    name                        = var.name
    delay_seconds               = var.delay_seconds
    max_message_size            = var.max_message_size
    message_retention_seconds   = var.message_retention_seconds
    visibility_timeout_seconds  = var.visibility_timeout_seconds
    policy                      = var.policy
    receive_wait_time_seconds   = var.receive_wait_time_seconds
    redrive_policy              = var.redrive_policy
    fifo_queue                  = var.fifo_queue
    content_based_deduplication = var.content_based_deduplication
  
    tags = {
       environment    = var.environment
       project        = var.project
       application_id = var.applicationId
       purpose        = var.purpose
    }
  
  }
  
  </code></pre>
  <p>Sourcing the above module into my project:</p>
  <pre><code>module &quot;main&quot; {
    source                      = &quot;git::https://git.url.here/aws/sqs.git?ref=feature/sqs_queue&quot;
    name                        = local.name
    delay_seconds               = var.delay_seconds
    max_message_size            = var.max_message_size
    message_retention_seconds   = var.message_retention_seconds
    visibility_timeout_seconds  = var.visibility_timeout_seconds
    policy                      = var.policy
    receive_wait_time_seconds   = var.receive_wait_time_seconds
    redrive_policy              = var.attach_redrive_policy == true ? local.redrive_policy : &quot;&quot;
    fifo_queue                  = var.fifo_queue
    content_based_deduplication = var.content_based_deduplication
  
    kms_master_key_id                 = data.aws_kms_alias.kms_sqs_key.target_key_arn
    kms_data_key_reuse_period_seconds = var.kms_data_key_reuse_period_seconds
  
    # I want to overwrite the Tags in comm module with the below tags
    tags = merge(module.tags.base_tags, module.tags.data_tags, module.tags.extra_tags,
      {
        &quot;Name&quot; = &quot;${local.name}_sqs_tags&quot;
      }
    )
  }
  
  module &quot;tags&quot; {
    source = &quot;../../../module/tags&quot;
  
    environment   = var.environment
    purpose       = var.description
    assetName     = local.name
    backupOwner   = &quot;owner.email&quot;
    dataCustodian = &quot;custodian.email&quot;
  }
  
  </code></pre>
  <p>And when i do <code>Terraform plan</code> everything plans out really well except the tags, i still only see the 4 tags that the comm module has instead of pushing my tags on top that module</p>
  <p><strong>P.S. if there are other ideas, like asking the community for the relevant edits on their module if overwriting is not possible. I would be very happy and greatly appreciated. Thank you</strong></p>