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

bug: embedded schema validation failed: the argument "body" is invalid: #429

Open
wardy1 opened this issue Dec 6, 2024 · 0 comments
Open

Comments

@wardy1
Copy link

wardy1 commented Dec 6, 2024

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Versions

Please paste the output of terraform version command from within the initialized directory:

Terraform v1.9.5
on windows_amd64
+ provider registry.terraform.io/azure/azapi v1.15.0
+ provider registry.terraform.io/hashicorp/azurerm v3.117.0

Please enter the module version that you are using:

4.1.5

Description

I've been using the LZ vending module for the Vnet creation and the Azure rm module for subnet creation, initial plan and apply works fine. Then something happens and i start getting the below error. This doesn't happen straight away so will keep working fine for a while and then i start getting the below:

Error: Invalid configuration

│ with module.lz_vending.module.virtualnetwork[0].azapi_resource.vnet["vnet-1"],
│ on .terraform\modules\lz_vending\modules\virtualnetwork\main.tf line 37, in resource "azapi_resource" "vnet":
│ 37: resource "azapi_resource" "vnet" {

│ embedded schema validation failed: the argument "body" is invalid:
properties.subnets.0.properties.defaultOutboundAccess is not expected here. Do you mean properties.subnets.0.properties.delegations?
properties.subnets.1.properties.defaultOutboundAccess is not expected here. Do you mean properties.subnets.1.properties.delegations?
properties.subnets.1.properties.serviceEndpoints.0.provisioningState is not expected here, it's read only
properties.subnets.2.properties.defaultOutboundAccess is not expected here. Do you mean properties.subnets.2.properties.delegations?
properties.subnets.2.properties.serviceEndpoints.0.provisioningState is not expected here, it's read only
properties.virtualNetworkPeerings.0.properties.peerCompleteVnets is not expected here. Do you mean
properties.virtualNetworkPeerings.0.properties.peeringState?
│ You can try to update azapi provider to the latest version or disable the validation using the feature flag schema_validation_enabled = false within the resource block

If i add as suggested the 'schema_validation_enabled = false' feature into the lz_vending module/network module config the plan/apply then works fine.

Screenshot of config below

Steps to Reproduce

  1. Standard deployment of Vnet:
  2. Add subnet config as below:
    resource "azurerm_subnet" "subnets" {
    for_each = var.subnet_configs
    provider = azurerm.agrimetrics-dsp
    name = each.key
    resource_group_name = var.networking_resource_group_name
    virtual_network_name = var.vnet_name
    address_prefixes = [each.value.address_prefix]
    private_endpoint_network_policies = lookup(each.value, "private_endpoint_network_policies", "Disabled")
    private_link_service_network_policies_enabled = lookup(each.value, "private_link_service_network_policies_enabled", false)
    service_endpoints = lookup(each.value, "service_endpoints", null)

dynamic "delegation" {
# Use the boolean flag to determine whether to create the dynamic block
for_each = each.value.enable_delegation ? [{}] : []

content {
  name = "delegation"

  service_delegation {
    name    = lookup(each.value.service_delegation, "name", "")
    actions = lookup(each.value.service_delegation, "actions", [])
  }
}

}
depends_on = [module.lz_vending]
}
3. Plan and apply - this will work and then something happens at a later point to cause the error.

Screenshots

Image

Additional context

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