hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.52k stars 4.6k forks source link

azurerm_container_registry_agent_pool does not assign tags to underlying resource #22397

Open artisticcheese opened 1 year ago

artisticcheese commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.4.6

AzureRM Provider Version

3.55.0

Affected Resource(s)/Data Source(s)

azurerm_container_registry_agent_pool

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "3.55.0"
    }
  }
}

locals {
  tags = {
    Product     = "DevOps"
    Contact     = "contact@company.com"
    Environment = "test1"
  }
}

resource "azurerm_resource_group" "example" {
  name     = "test-rg"
  location = "EastUS"
  tags     = local.tags
}

resource "azurerm_container_registry" "example" {
  name                = "exdddampleacr"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  sku                 = "Premium"
  tags                = local.tags
}

resource "azurerm_container_registry_agent_pool" "example" {
  timeouts {
    create = "15m"
  }
  name                    = "example-pool-tags"
  resource_group_name     = azurerm_resource_group.example.name
  location                = azurerm_resource_group.example.location
  container_registry_name = azurerm_container_registry.example.name
  tags                    = local.tags
}

Debug Output/Panic Output

https://gist.github.com/artisticcheese/e0e7dad02a506eaf71753a943759aac2

Expected Behaviour

Shall be creating agent pool with tags

Actual Behaviour

No tags assigned to actual agent pool image

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

magodo commented 1 year ago

@artisticcheese Sorry for running into this! I've been looked into it locally and noticed that in the PUT request to create the pool actually have the tags set in the request body, while after it's been created, the response body doesn't reflect that.

May I know where is the entry point to the agent pool from ACR in Portal? So that I can test what happens after I manually add the tags (the update request of the pool doesn't have the tags defined, so the azure CLI can't be used to update the tags).

artisticcheese commented 1 year ago

You need to click show hidden types and then you can get to a pool in portal image Updating through portal is not working either obviously, since as you mentioned PUT request does not allow tags.