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

terraform validate produces Errors: Unsupported block #665

Closed
simonlock opened this issue Feb 6, 2024 · 3 comments
Closed

terraform validate produces Errors: Unsupported block #665

simonlock opened this issue Feb 6, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@simonlock
Copy link

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?

@simonlock simonlock added the bug Something isn't working label Feb 6, 2024
@shibayan
Copy link
Owner

shibayan commented Feb 7, 2024

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

@simonlock
Copy link
Author

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
Copy link
Author

Thanks for your help on this. Found these links:

hashicorp/terraform-provider-azurerm#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

@shibayan shibayan closed this as completed Feb 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants