aztfmod / terraform-provider-azurecaf

Terraform provider for the Terraform platform engineering for Azure
MIT License
174 stars 93 forks source link

Resource type not passing validation #40

Closed vaclav-dvorak closed 3 years ago

vaclav-dvorak commented 3 years ago

New resource types in v1.0.0 do not seem to pass validation. Tested on psql. Even though models_generated.go contain psql as resource type when its passed to terraform it throw validation error.

Test

provider "azurecaf" {
  version = "~> 1.0.0"
}

resource "azurecaf_naming_convention" "psql" {
  name          = "foo"
  resource_type = "psql"
  convention    = "cafclassic"
}

then execute terraform init and terraform validate

Expected

this to pass validation

Actual

Validation error is thrown

Error: expected resource_type to be one of [apim app evh gen acr afw appi snet sql vmw asr pip rg plan agw aksnpl aksnpw kv st vml aaa aksdns ase la nsg aks nic sqldb vnet azurerm_app_service_plan azurerm_sql_server azurerm_windows_virtual_machine_windows aks_dns_prefix aks_node_pool_windows azurerm_network_security_group azurerm_public_ip azurerm_container_registry azurerm_app_service_environment azurerm_eventhub_namespace azurerm_resource_group azurerm_automation_account azurerm_windows_virtual_machine_linux azurerm_api_management azurerm_recovery_services_vault generic azurerm_network_interface azurerm_key_vault azurerm_subnet azurerm_sql_database azurerm_firewall azurerm_application_gateway azurerm_app_service azurerm_application_insights azurerm_kubernetes_cluster aks_node_pool_linux azurerm_log_analytics_workspace azurerm_storage_account azurerm_virtual_network], got psql

  on main.tf line 5, in resource "azurecaf_naming_convention" "psql":
   5: resource "azurecaf_naming_convention" "psql" {
arnaudlh commented 3 years ago

hi @vaclav-dvorak can you please try with?

provider "azurecaf" {
  version = "~> 1.0.0"
}

resource "azurecaf_name" "psql" {
  name          = "foo"
  resource_type = "azurerm_postgresql_server"
}

As resource azurecaf_naming_convention is the old logic. Please let us know.

vaclav-dvorak commented 3 years ago

This indeed works. Thanks for clarification on new resource. Missed that in docs.