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_communication_service doesn't support US Gov #23719

Open dptaf opened 1 year ago

dptaf commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.6.2

AzureRM Provider Version

3.78.0

Affected Resource(s)/Data Source(s)

azurerm_communication_service

Terraform Configuration Files

resource "azurerm_communication_service" "email" {
  name                = "email-${var.environment}"
  resource_group_name = "common"
  data_location       = "US Gov"
}

Debug Output/Panic Output

Error: expected data_location to be one of ["Africa" "Asia Pacific" "Australia" "Brazil" "Canada" "Europe" "France" "Germany" "India" "Japan" "Korea" "Norway" "Switzerland" "UAE" "UK" "United States"], got US Gov
│ 
│   with azurerm_communication_service.email,
│   on email-manager.tf line 46, in resource "azurerm_communication_service" "email":
│   46:   data_location       = "US Gov"

Expected Behaviour

I'd expect that we can pass in US Gov as a value to data_location.

Actual Behaviour

I'm getting a validation failure on data_location.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

sinbai commented 1 year ago

Hi @dptaf thanks for opening this issue. Per Azure Communication Services for US Government and Data residency documentation, the feature of Azure Communication Services is currently in preview. Not recommended for production workloads. In additional, Terraform generally supports stable API versions, so I assume that US Gov could not be supported by Terraform currently.

tombuildsstuff commented 1 year ago

@sinbai it's worth noting the API Definitions don't contain the list of Data Locations (which is why this is hard-coded in the Provider, which is where this validation error is coming from) - it's possible that the Service itself is in Preview in the Azure Government environment, whilst using a Stable API version.

I'd suggest we reach out to the Service Team to confirm which API Version this is supported in, and to get the list of possible values for dataLocation added to the API Definition - since these should be being populated, which'll give us the information we need to support this.

jjm123960 commented 3 weeks ago

Same issue here. Any updates on this?

Missed this on first search (closed dupe: https://github.com/hashicorp/terraform-provider-azurerm/issues/27689)

MichaelChristopherson commented 1 day ago

@sinbai - Any update on this issue. Azure Communication Service is publicly available and should be functional in usgov. When I try to create these objects using the United States Data location I get the following error:

Error: creating Communication Service (Subscription: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Resource Group Name: "<my-resource-group-name>"
Communication Service Name: "SharedServicesCommunicationService"): performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with error: InvalidDataLocation: Requested data location unitedstates is not supported. Supported locations: (usgov)

  with azurerm_communication_service.<resource-name>,
  on <my-file-name>.tf line 1, in resource "azurerm_communication_service" "<resource-name>":
   1: resource "azurerm_communication_service" "<resource-name>" {

creating Communication Service (Subscription:
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
Resource Group Name: "<my-resource-group-name>"
Communication Service Name: "SharedServicesCommunicationService"):
performing CreateOrUpdate: unexpected status 400 (400 Bad Request) with
error: InvalidDataLocation: Requested data location unitedstates is not
supported. Supported locations: (usgov)

Once I update the terraform to use the usgov location like this:

resource "azurerm_communication_service" "example" {
  name                = "SharedServicesCommunicationService"
  resource_group_name = azurerm_resource_group.example.name
  data_location       = "usgov"
}

resource "azurerm_email_communication_service" "email_example" {
  name                = "SharedServicesEmailCommunicationService"
  resource_group_name = azurerm_resource_group.example.name
  data_location       = "usgov"

  depends_on = [ 
    azurerm_communication_service.example
  ]
}

resource "azurerm_email_communication_service_domain" "example" {
  name             = "example.us"
  email_service_id = azurerm_email_communication_service.email_example.id

  domain_management = "CustomerManaged"
}

resource "azurerm_communication_service_email_domain_association" "example" {
  communication_service_id = azurerm_communication_service.example.id
  email_service_domain_id  = azurerm_email_communication_service_domain.example.id
}

I get the following error:

Error: expected data_location to be one of ["Africa" "Asia Pacific" "Australia" "Brazil" "Canada" "Europe" "France" "Germany" "India" "Japan" "Korea" "Norway" "Switzerland" "UAE" "UK" "United States"], got usgov

  with azurerm_communication_service.example,
  on <my-file>.tf line 4, in resource "azurerm_communication_service" "example":
   4:   data_location       = "usgov"

Ill be adding a PR shortly and testing manually to make sure I can create the resources.