Here’s my entire, simple file tossing the error. I’m not sure what’s happening, and I’m a noob to Terraform:
We strongly recommend using the required_providers block to set the
Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “=2.46.0”
}
}
}
Configure the Microsoft Azure Provider
provider “azurerm” {
features {}
subscription_id = “#####”
tenant_id = “#####”
}
locals {
azure_location = “East US”
}
resource “azurerm__resource_group” “primary_vnet_resource_group” {
name = “vnet-prood-002-eastus-001”
location = local.azure_locationx
}
resource “azurerm_virtual_network” “primary_vnet_virtual_network” {
name = “vnet_primary_eastus-001”
location = local.azure_location
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_space = [“10.0.0.0/16”]
}
azurerm_subnet {
name = “snet-aks-prod-002-eastus-001”
virtual_network_name = “primary_vnet_virtual_network.name”
resource_group_name = “azurerm_resource_group.primary_vnet_resource_group.name”
address_prefix = “10.0.1.0/24”
}
azurerm_subnet {
name = “snet-app-prod-002-eastus-001”
location = local.azure_location
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_prefix = “10.0.2.0/24”
}
azurerm_subnet {
name = “snet-postgres-prod-002-eastus-001”
location = local.azure_location
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_prefix = “10.0.3.0/24”
}
}
Please help, I’ve followed the examples.
Fixed some stupid mistakes, now it’s " Error: Argument or block definition required
│
│ on main.tf line 60:
│ 60: }
│
│ An argument or block definition is required here.
"
main.tf:
We strongly recommend using the required_providers block to set the
Azure Provider source and version being used
terraform {
required_providers {
azurerm = {
source = “hashicorp/azurerm”
version = “=2.46.0”
}
}
}
Configure the Microsoft Azure Provider
provider “azurerm” {
features {}
subscription_id = “#####”
tenant_id = “#####”
}
locals {
azure_location = “East US”
}
resource “azurerm__resource_group” “primary_vnet_resource_group” {
name = “vnet-prood-002-eastus-001”
location = local.azure_location
}
resource “azurerm_virtual_network” “primary_vnet_virtual_network” {
name = “vnet_primary_eastus-001”
location = local.azure_location
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_space = [“10.0.0.0/16”]
}
resource “azurerm_subnet” “aks-subnet” {
name = “snet-aks-prod-002-eastus-001”
location = local.azure_location
virtual_network_name = “primary_vnet_virtual_network.name”
resource_group_name = “azurerm_resource_group.primary_vnet_resource_group.name”
address_prefix = “10.0.1.0/24”
}
resource “azurerm_subnet” “application-subnet” {
name = “snet-app-prod-002-eastus-001”
location = local.azure_location
virtual_network_name = “primary_vnet_virtual_network.name”
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_prefix = “10.0.2.0/24”
}
resource “azurerm_subnet” “postgres-subnet” {
name = “snet-postgres-prod-002-eastus-001”
location = local.azure_location
virtual_network_name = “primary_vnet_virtual_network.name”
resource_group_name = azurerm_resource_group.primary_vnet_resource_group.name
address_prefix = “10.0.3.0/24”
}
}
Figured it out, it was the last “}” that seemed to be the issue. I hope this helps any newbies.