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.59k stars 4.62k forks source link

Validate - Support for symbolic name resources requires a minimum API version #22259

Open Gordonby opened 1 year ago

Gordonby commented 1 year ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.2

AzureRM Provider Version

3.62

Affected Resource(s)/Data Source(s)

azurerm

Terraform Configuration Files

#providers.tf

terraform {
  required_version = ">=1.3.2"
  required_providers {
    azurerm = {
      source = "hashicorp/azurerm"
      version = "~>3.48"
    }
  }
}

provider "azurerm" {
  features {}
}

#main.tf

data "http" "aksc_release" {
  url = "https://github.com/Azure/AKS-Construction/releases/download/0.9.17/main.json"
  request_headers = {
    Accept = "application/json"
    User-Agent = "request module"
  }
}

data "azurerm_client_config" "current" {}

resource "azurerm_resource_group" "rg" {
  name = var.resourceGroupName
  location = var.location
}

resource "azurerm_resource_group_template_deployment" "aksc_deploy" {
  name = "AKS-C"
  resource_group_name = azurerm_resource_group.rg.name
  deployment_mode = "Incremental"
  template_content = data.http.aksc_release.response_body
  parameters_content = jsonencode({
    resourceName = {value=var.resourceName}
    agentCount = {value=var.agentCount}
    JustUseSystemPool = {value=var.JustUseSystemPool}
    osDiskType = {value=var.osDiskType}
    osDiskSizeGB = {value=var.osDiskSizeGB}
    automationAccountScheduledStartStop = {value=var.automationAccountScheduledStartStop}
  })
}

#variables.tf

variable resourceGroupName {
  type=string
  default="az-k8s-dr3x-rg"
}
variable location {
  type=string
  default="WestEurope"
} 
variable resourceName {
  type=string
  default="az-k8s-dr3x"
} 
variable agentCount {
  type=number
  default=1
} 
variable JustUseSystemPool {
  type=bool
  default=true
} 
variable osDiskType {
  type=string
  default="Managed"
} 
variable osDiskSizeGB {
  type=number
  default=32
} 
variable automationAccountScheduledStartStop {
  type=string
  default="Weekday"
}

#outputs.tf

output aksClusterName {
  value = jsondecode(azurerm_resource_group_template_deployment.aksc_deploy.output_content).aksClusterName.value
  description = "The name of the AKS cluster."
}
output userClientId {
  value = data.azurerm_client_config.current.client_id
  description = "Current User ClientId"
}
output userObjectId {
  value = data.azurerm_client_config.current.object_id
  description = "Current User ObjectId"
}

Debug Output/Panic Output

2023-06-23T08:54:00.020Z [DEBUG] provider.terraform-provider-azurerm_v3.62.0_x5: AzureRM Response for https://management.azure.com/subscriptions/REDACTED/resourcegroups/az-k8s-dr3x-rg/providers/Microsoft.Resources/deployments/AKS-C/validate?api-version=2020-06-01: 
HTTP/2.0 400 Bad Request
Content-Length: 177
Cache-Control: no-cache
Content-Type: application/json; charset=utf-8
Date: Fri, 23 Jun 2023 08:53:59 GMT
Expires: -1
Pragma: no-cache
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Content-Type-Options: nosniff
X-Ms-Correlation-Request-Id: 49692083-00fa-e9b8-73f4-0bc8a6365144
X-Ms-Failure-Cause: gateway
X-Ms-Ratelimit-Remaining-Subscription-Writes: 1199
X-Ms-Request-Id: cdd64c0b-3cec-4c12-b2e3-ae74d810da92
X-Ms-Routing-Request-Id: WESTEUROPE:20230623T085400Z:cdd64c0b-3cec-4c12-b2e3-ae74d810da92

{"error":{"code":"InvalidDeployment","message":"Support for symbolic name resources requires a minimum API version of '2020-09-01', but API version '2020-06-01' was supplied."}}: timestamp=2023-06-23T08:54:00.019Z
2023-06-23T08:54:00.020Z [ERROR] provider.terraform-provider-azurerm_v3.62.0_x5: Response contains error diagnostic: @module=sdk.proto tf_resource_type=azurerm_resource_group_template_deployment @caller=github.com/hashicorp/terraform-plugin-go@v0.14.3/tfprotov5/internal/diag/diagnostics.go:55 diagnostic_detail= diagnostic_severity=ERROR diagnostic_summary="validating Template Deployment "AKS-C" (Resource Group "az-k8s-dr3x-rg"): requesting validating: resources.DeploymentsClient#Validate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidDeployment" Message="Support for symbolic name resources requires a minimum API version of '2020-09-01', but API version '2020-06-01' was supplied."" tf_proto_version=5.3 tf_provider_addr=provider tf_req_id=a08ed4ce-cfa2-2a46-134f-f73a622d8f84 tf_rpc=ApplyResourceChange timestamp=2023-06-23T08:54:00.020Z
2023-06-23T08:54:00.179Z [ERROR] vertex "azurerm_resource_group_template_deployment.aksc_deploy" error: validating Template Deployment "AKS-C" (Resource Group "az-k8s-dr3x-rg"): requesting validating: resources.DeploymentsClient#Validate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidDeployment" Message="Support for symbolic name resources requires a minimum API version of '2020-09-01', but API version '2020-06-01' was supplied."
╷
│ Error: validating Template Deployment "AKS-C" (Resource Group "az-k8s-dr3x-rg"): requesting validating: resources.DeploymentsClient#Validate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidDeployment" Message="Support for symbolic name resources requires a minimum API version of '2020-09-01', but API version '2020-06-01' was supplied."
│ 
│   with azurerm_resource_group_template_deployment.aksc_deploy,
│   on main.tf line 18, in resource "azurerm_resource_group_template_deployment" "aksc_deploy":
│   18: resource "azurerm_resource_group_template_deployment" "aksc_deploy" {
│ 
╵
2023-06-23T08:54:00.445Z [DEBUG] provider.stdio: received EOF, stopping recv loop: err="rpc error: code = Unavailable desc = error reading from server: EOF"

Expected Behaviour

Deployment success. This used to work. I've tried rolling back to 3.6 and it still fails. The only resource using 2020-06-01 is networking related....

  1. They're conditional, and not being deployed
  2. The API versions are the latest available.

image

Actual Behaviour

Validation error message. Support for symbolic name resources requires a minimum API version of '2020-09-01', but API version '2020-06-01' was supplied.

Steps to Reproduce

terraform fmt terraform init terraform validate terraform plan -out main.tfplan terraform apply main.tfplan terraform output

Important Factoids

No response

References

No response

TheVexy commented 1 year ago

Any news on this? I get the same Behaviour when trying to deploy resource azurerm_subscription_template_deployment

kc8421 commented 2 weeks ago

This is still an active issue.