Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The request content was invalid and could not be deserialized #308

Open
bicisteadm opened this issue Nov 21, 2024 · 0 comments
Open

The request content was invalid and could not be deserialized #308

bicisteadm opened this issue Nov 21, 2024 · 0 comments

Comments

@bicisteadm
Copy link

When attempting to deploy aks-engine-azurestack ARM templates with Terraform, I encounter the error:
The request content was invalid and could not be deserialized.

 Error: creating Template Deployment "project-k8s-test-dc" (Resource Group "project-k8s-test-dc"): resources.DeploymentsClient#CreateOrUpdate: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidRequestContent" Message="The request content was invalid and could not be deserialized: 'Error converting value \"https://schema.management.azure.com/schemas/2019-04-01/deploymentParameters.json#\" to type 'Azure.Deployments.Core.Definitions.DeploymentParameterDefinition'. Path 'properties.parameters.$schema', line 1, position 130438.'."
│
│   with azurestack_template_deployment.project_k8s_test_dc,
│   on main.tf line 34, in resource "azurestack_template_deployment" "project_k8s_test_dc":
│   34: resource "azurestack_template_deployment" "project_k8s_test_dc" {

I generate the templates using:

aks-engine-azurestack generate --api-model project-test-dc-apimodel.json --client-id "" --client-secret "" --output-directory project-k8s-test-dc
If I deploy the templates using:

az deployment group validate --resource-group project-rg-k8s-test-dc --template-file azuredeploy.json --parameters azuredeploy.parameters.json
the deployment works fine.

Here is my Terraform code:

# We strongly recommend using the required_providers block to set the
# Azure Provider source and version being used
terraform {
  required_providers {
    azurestack = {
        source = "hashicorp/azurestack"
        version = "1.0.0"
    }
  }
}

# Configure the Microsoft Azure Stack Provider
provider "azurestack" {
  features {}

  # More information on the authentication methods supported by
  # the AzureStack Provider can be found here:
  # https://registry.terraform.io/providers/hashicorp/azurestack/latest/docs

  environment = "custom"

  metadata_host = "management.dc.azurestack.domain.com"
  # subscription_id   = "..."
  # client_id         = "..."
  # client_secret     = "..."
  tenant_id         = ""
}

resource "azurestack_resource_group" "project_rg_k8s_test_dc" {
  name     = "project-rg-k8s-test-dc"
  location = "dc"
}

resource "azurestack_template_deployment" "project_k8s_test_dc" {
  name                = "project-k8s-test-dc"
  resource_group_name = azurestack_resource_group.project_rg_k8s_test_dc.name

  template_body = file("aks-engine-apimodels/project-k8s-test-dc/azuredeploy.json")
  parameters_body = file("aks-engine-apimodels/project-k8s-test-dc/azuredeploy.parameters.json")

  deployment_mode = "Incremental"
}

Other actions, such as creating a resource group (RG), work without any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant