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.65k forks source link

Resource `azurerm_datadog_monitor_sso_configuration` can't be used with certain `enterprise_application_id` values #25904

Open clowa opened 6 months ago

clowa commented 6 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.8.3

AzureRM Provider Version

3.102.0

Affected Resource(s)/Data Source(s)

azurerm_datadog_monitor_sso_configuration

Terraform Configuration Files

terraform {
  required_version = "=1.8.3"

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=3.102.0"
    }
  }
}

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "datadog" {
  name     = "datadog-rg"
  location = "West US 2"
}

resource "azurerm_datadog_monitor" "datadog" {
  name                = "datadog-org"
  resource_group_name = azurerm_resource_group.datadog.name
  location            = azurerm_resource_group.datadog.location

  datadog_organization {
    api_key         = "XXXX"
    application_key = "XXXX"
  }

  user {
    name  = "datadog"
    email = "abc@xyz.com"
  }

  sku_name = "Linked"

  identity {
    type = "SystemAssigned"
  }
}

resource "azurerm_datadog_monitor_sso_configuration" "datadog" {
  datadog_monitor_id        = azurerm_datadog_monitor.datadog.id
  single_sign_on_enabled    = "Enable"
  enterprise_application_id = "15d6001c-80a6-471e-8e7a-1fa975336b2a"
}

Debug Output/Panic Output

╷
│ Error: expected value of enterprise_application_id not match regular expression, got 15d6001c-80a6-471e-8e7a-1fa975336b2a
│ 
│   with azurerm_datadog_monitor_sso_configuration.datadog,
│   on datadog.tf line 54, in resource "azurerm_datadog_monitor_sso_configuration" "datadog":
│   54:   enterprise_application_id = "15d6001c-80a6-471e-8e7a-1fa975336b2a"
│ 
╵
2024-05-08T12:37:24.554Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"
2024-05-08T12:37:24.570Z [DEBUG] provider: plugin process exited: path=.terraform/providers/registry.terraform.io/hashicorp/azurerm/3.102.0/linux_arm64/terraform-provider-azurerm_v3.102.0_x5 pid=20279
2024-05-08T12:37:24.570Z [DEBUG] provider: plugin exited

Expected Behaviour

The resource should accept the value of a Entra ID Enterprise application Application ID field, containing a GUID.

Actual Behaviour

The provider validates the value with the regex [0-9-]$ wich doesn't allow letters as used by hex numbers.

For some reason I can't find out yet the provider accepts 3fa85f64-5717-4562-b3fc-2c963f66afa6, which is just another example Application ID I tried.

Steps to Reproduce

  1. Run terraform plan with the example code provided.

Important Factoids

no

References

No response

clowa commented 6 months ago

Just some more information: Without special knowledge about the datadog background, the ARM API looks like there are no restrictions on the value of enterprise_application_id.