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.6k stars 4.64k forks source link

[AzureRM-v4.x]Resource: azurerm_bot_service_azure_bot is always trying to add value for parameter: developer_app_insights_api_key even if the value is null #27382

Closed babuga365 closed 1 month ago

babuga365 commented 1 month ago

Is there an existing issue for this?

Community Note

Terraform Version

1.9

AzureRM Provider Version

4.2.0

Affected Resource(s)/Data Source(s)

azurerm_4.2.0

Terraform Configuration Files

Terraform resource definition on module:
======================================== 
resource "azurerm_bot_service_azure_bot" "main" {
  name                                  = var.bot_name
  location                              = var.location
  resource_group_name                   = var.resource_group_name
  display_name                          = var.display_name
  sku                                   = var.sku
  microsoft_app_type                    = var.microsoft_app_type
  microsoft_app_id                      = var.microsoft_app_id
  developer_app_insights_api_key        = var.developer_app_insights_api_key
  developer_app_insights_key            = var.developer_app_insights_key
  developer_app_insights_application_id = var.developer_app_insights_application_id
  microsoft_app_msi_id                  = var.microsoft_app_msi_id
  microsoft_app_tenant_id               = var.microsoft_app_tenant_id
  luis_app_ids                          = var.luis_app_ids
  luis_key                              = var.luis_key
  streaming_endpoint_enabled            = var.streaming_endpoint_enabled
  public_network_access_enabled         = var.public_network_access_enabled
  endpoint                              = var.endpoint
  cmk_key_vault_key_url                 = var.cmk_key_vault_key_url
  local_authentication_enabled          = var.local_authentication_enabled
  tags                                  = var.tags
}

Variable definition:
=====================
variable "developer_app_insights_api_key" {
  description = "(Optional) The Application Insights API Key to associate with this Azure Bot Service. Defaults to `Null`."
  type        = string
  default     = null
}

Debug Output/Panic Output

I could see the parameter is adding some sensitive value in terraform plan
 # module.emea-weu-s100-inf-d-01-bot.azurerm_bot_service_azure_bot.main will be updated in-place
  ~ resource "azurerm_bot_service_azure_bot" "main" {
      + developer_app_insights_api_key        = (sensitive value)
        id                                    = "/subscriptions/xxxxxx/resourceGroups/SHARED-RG/providers/Microsoft.BotService/botServices/AKS-01-BOT"
        name                                  = "AKS-01-BOT"
        tags                                  = {
            "createdBy"        = "Pipeline"
            "repository"       = "Cloud8"
            "subPurpose"       = "Development"
        }

Expected Behaviour

It should show any addition if the parameter value is null as its optional parameter in terraform provider https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/bot_service_azure_bot#developer_app_insights_api_key

Actual Behaviour

Trying to add some sensitive value

Steps to Reproduce

No response

Important Factoids

No response

References

https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/bot_service_azure_bot#developer_app_insights_api_key

neil-yechenwei commented 1 month ago

Thanks for raising this issue. Seems I can't reproduce this issue with below tf config that is similar with yours. Could you try below tf config to see if the issue still exists?

tf config:

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-bot-test01"
  location = "westeurope"
}

variable "developer_app_insights_api_key" {
  type    = string
  default = null
}

resource "azurerm_bot_service_azure_bot" "test" {
  name                                  = "acctestdftest01"
  resource_group_name                   = azurerm_resource_group.test.name
  location                              = "global"
  sku                                   = "F0"
  microsoft_app_id                      = data.azurerm_client_config.current.client_id
  developer_app_insights_application_id = var.developer_app_insights_api_key
}

![Uploading image.png…]()

neil-yechenwei commented 1 month ago

Thanks for raising this issue. Seems I can't reproduce this issue with below tf config that is similar with yours. Could you try below tf config to see if the issue still exists?

Repro steps:

  1. Run tf apply with below tf config
  2. Run tf plan and no difference is found

tf config:

provider "azurerm" {
  features {}
}

data "azurerm_client_config" "current" {
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-bot-test01"
  location = "westeurope"
}

variable "developer_app_insights_api_key" {
  type    = string
  default = null
}

resource "azurerm_bot_service_azure_bot" "test" {
  name                                  = "acctestdftest01"
  resource_group_name                   = azurerm_resource_group.test.name
  location                              = "global"
  sku                                   = "F0"
  microsoft_app_id                      = data.azurerm_client_config.current.client_id
  developer_app_insights_application_id = var.developer_app_insights_api_key
}

image

babuga365 commented 1 month ago

Thanks for your reply and I have found the issue in my configuration. Its working as expected. Hence closing this bug

github-actions[bot] commented 1 week ago

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.