TFFR4 - AzAPI - response_export_values

ID: TFFR4 - Category: Composition - AzAPI - response_export_values

Authors MUST specify the response_export_values argument when using the AzAPI provider:

resource "azapi_resource" "example" {
  type      = "Microsoft.Example/resourceType@2021-01-01"
  name      = "example-resource"
  location  = "West US"
  response_export_values = [] # must be specified, even if empty
  body = {
    properties = {
      exampleProperty = "exampleValue"
    }
  }
}

If you require read-only properties to be returned from the resource, you SHOULD include them as follows:

resource "azapi_resource" "example" {
  type      = "Microsoft.Example/resourceType@2021-01-01"
  name      = "example-resource"
  location  = "West US"
  # Example as a list:
  response_export_values = ["properties.readOnlyProperty"]
  # Example as a map:
  # response_export_values = {
  #   read_only_property = "properties.readOnlyProperty"
  # }
  body = {
    properties = {
      exampleProperty = "exampleValue"
    }
  }
}

output "read_only_property" {
  # Example if response_export_values is a list:
  value = azapi_resource.example.output.properties.readOnlyProperty
  # Example if response_export_values is a map:
  # value = azapi_resource.example.output.read_only_property
}