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

feat: azapi v2 support #406

Open
matt-FFFFFF opened this issue Aug 16, 2024 · 3 comments · May be fixed by #434
Open

feat: azapi v2 support #406

matt-FFFFFF opened this issue Aug 16, 2024 · 3 comments · May be fixed by #434
Milestone

Comments

@matt-FFFFFF
Copy link
Member

Update the module to take advantage of the many improvements in azapi v2

@matt-FFFFFF matt-FFFFFF added this to the v5.0 milestone Aug 16, 2024
@ekrof
Copy link

ekrof commented Oct 21, 2024

This needs to be prioritized as you're using >= version constraints against the AzAPI provider, now officially released in v2.0.1. There's no upper bound version e.g. = ">= 1.4.0, < 2.0.0". Currently facing issues when deploying with this module:


│ Error: Invalid body

│   with module.lz-vending.azapi_resource.telemetry_root,
│   on .terraform/modules/lz-vending/main.telemetry.tf line 3, in resource "azapi_resource" "telemetry_root":
│    3: resource "azapi_resource" "telemetry_root" {

│ The argument "body" is invalid: unmarshaling failed: value:
│ "{\"properties\":{\"mode\":\"Incremental\",\"template\":{\"$schema\":\"https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#\",\"contentVersion\":\"1.0.0.0\",\"outputs\":{\"telemetry\":{\"type\":\"String\",\"value\":\"For
│ more information, see
│ https://aka.ms/lz-vending/tf/telemetry\"}},\"parameters\":{},\"resources\":[],\"variables\":{}}}}",
│ err: json: cannot unmarshal string into Go value of type
│ map[string]interface {}


│ Error: Invalid Type

│   with module.lz-vending.azapi_resource.telemetry_root,
│   on .terraform/modules/lz-vending/main.telemetry.tf line 9, in resource "azapi_resource" "telemetry_root":
│    9:   body = jsonencode({
│   10:     properties = {
│   11:       mode     = "Incremental"
│   12:       template = local.telem_arm_subscription_template
│   13:     }
│   14:   })

│ The value must not be a string


│ Error: Invalid body

│   with module.lz-vending.module.resourcegroup_networkwatcherrg.azapi_resource.rg,
│   on .terraform/modules/lz-vending/modules/resourcegroup/main.tf line 1, in resource "azapi_resource" "rg":
│    1: resource "azapi_resource" "rg" {

│ The argument "body" is invalid: unmarshaling failed: value: "{}", err:
│ json: cannot unmarshal string into Go value of type map[string]interface {}


│ Error: Invalid body

│   with module.lz-vending.module.resourcegroup.azapi_resource.rg,
│   on .terraform/modules/lz-vending/modules/resourcegroup/main.tf line 1, in resource "azapi_resource" "rg":
│    1: resource "azapi_resource" "rg" {

│ The argument "body" is invalid: unmarshaling failed: value: "{}", err:
│ json: cannot unmarshal string into Go value of type map[string]interface {}


│ Error: Invalid Type

│   with module.lz-vending.module.resourcegroup_networkwatcherrg.azapi_resource.rg,
│   on .terraform/modules/lz-vending/modules/resourcegroup/main.tf line 6, in resource "azapi_resource" "rg":
│    6:   body      = jsonencode({})

│ The value must not be a string


│ Error: Invalid Type

│   with module.lz-vending.module.resourcegroup.azapi_resource.rg,
│   on .terraform/modules/lz-vending/modules/resourcegroup/main.tf line 6, in resource "azapi_resource" "rg":
│    6:   body      = jsonencode({})

│ The value must not be a string


│ Error: Invalid body

│   with module.lz-vending.module.usermanagedidentity.azapi_resource.umi,
│   on .terraform/modules/lz-vending/modules/usermanagedidentity/main.tf line 32, in resource "azapi_resource" "umi":
│   32: resource "azapi_resource" "umi" {

│ The argument "body" is invalid: unmarshaling failed: value: "{}", err:
│ json: cannot unmarshal string into Go value of type map[string]interface {}


│ Error: Invalid Type

│   with module.lz-vending.module.usermanagedidentity.azapi_resource.umi,
│   on .terraform/modules/lz-vending/modules/usermanagedidentity/main.tf line 36, in resource "azapi_resource" "umi":
│   36:   body      = jsonencode({})

│ The value must not be a string

Error: Process completed with exit code 1.

@matt-FFFFFF
Copy link
Member Author

Hi @ekrof

You can introduce your own constraints in your root module whilst we work on this

Also checking the lock file into source control can prevent provider upgrades.

@ekrof
Copy link

ekrof commented Oct 21, 2024

Hi @ekrof

You can introduce your own constraints in your root module whilst we work on this

Just realized after posting this. Thanks. The other AVM modules we use still haven't been updated to support Azurerm v4 either, so that's a shame.

  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 3.0, < 5.0"
    }
    azapi = {
      source  = "azure/azapi"
      version = "~> 1"
    }
  }

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

Successfully merging a pull request may close this issue.

2 participants