shibayan / keyvault-acmebot

Automated ACME SSL/TLS certificates issuer for Azure Key Vault (App Service / Container Apps / App Gateway / Front Door / CDN / others)
Apache License 2.0
891 stars 233 forks source link

terraform validate produces Errors: Unsupported block #665

Closed simonlock closed 7 months ago

simonlock commented 7 months ago

Hi shibayan

The terraform module seems to no longer work and fails the terraform validation, but the Arm template works great.

Issuing the "terraform validate" produces:

│ Error: Unsupported block type
│ 
│   on .terraform/modules/keyvault_acmebot/main.tf line 86, in resource "azurerm_windows_function_app" "function":
│   86:   dynamic "sticky_settings" {
│ 
│ Blocks of type "sticky_settings" are not expected here.
│ Error: Unsupported block type
│ 
│   on .terraform/modules/keyvault_acmebot/main.tf line 98, in resource "azurerm_windows_function_app" "function":
│   98:   dynamic "auth_settings_v2" {
│ 
│ Blocks of type "auth_settings_v2" are not expected here

This is whilst explicitly defining the required 5 variables e.g.

  module "keyvault_acmebot" {
   source  = "shibayan/keyvault-acmebot/azurerm"
   version = "3.0.1"

   app_base_name         = "ssl"
   resource_group_name   = "ssl"
   location              = "uksouth"
   mail_address          = "email@address.co.uk"
   vault_uri             = "https://vaultname.vault.azure.net"

   azure_dns = {
     subscription_id = data.azurerm_client_config.current.subscription_id
   }
 }

and whilst using the azurerm provider:

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.0.0"
    }
  }
}

I might be doing something wrong.

Btw does the terraform module require a pre-existing key vault to exist, unlike the Arm template?

shibayan commented 7 months ago

This problem occurs when the version of Terraform Provider is older. Try changing the version specification to version = "~> 3.0"

simonlock commented 7 months ago

Thank you so much for your quick reply and suggestion. However, changing the version specification to version = "~> 3.0" didn't solve this issue. Running "terraform init" followed by "terraform validate" produces the same errors.

terraform --version
Terraform v1.7.2
on linux_arm64
+ provider registry.terraform.io/hashicorp/azurerm v3.0.2
+ provider registry.terraform.io/hashicorp/random v3.1.0
simonlock commented 7 months ago

Thanks for your help on this. Found these links:

https://github.com/hashicorp/terraform-provider-azurerm/issues/21006 https://github.com/hashicorp/terraform-provider-azurerm/blob/v3.49.0/CHANGELOG.md

setting: version = "~> 3.49.0"

terraform init -upgrade

Fixed this issue.

terraform --version
Terraform v1.7.2
on linux_arm64
+ provider registry.terraform.io/hashicorp/azurerm v3.49.0
+ provider registry.terraform.io/hashicorp/random v3.1.3