working on creating a module, getting this error:
Error: Argument or block definition required
│
│ On .terraform/modules/nsg-main/nsg-main/main.tf line 43: An argument or block definition is required here.
here is the module code:
main.tf:
resource "azurerm_network_security_group" "NSG1" {
name = var.name #"testNSG1" #name of the NSG
location = var.location #"westus2" #azurerm_resource_group.example.location #what region
resource_group_name = var.rgname #azurerm_resource_group.rg.name #this assigns to the RG thats created above
##### security rules go below
## priority max is 4096
security_rule {
name = "test123" #name of the rule
priority = 100
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22" #add your ports here
source_address_prefix = "10.2.2.0/24" #add inbound address range or IPs
destination_address_prefix = "*" #add local, IPs or ranges that this rule effects "*" for everything in NSG
}
security_rule {
name = "denyall-rule" #name of the rule
priority = 4000
direction = "Inbound"
access = "Deny"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "*" #add your ports here
source_address_prefix = "0.0.0.0/0" #add inbound address range or IPs
destination_address_prefix = "*" #add local, IPs or ranges that this rule effects "*" for everything in NSG
}
tags = var.tags
}
and variables:
variable "name" {
Desscription = "test here"
type = string
}
variable "location" {
Desscription = "test here"
type = string
}
variable "rgname" {
Desscription = "test here"
type = string
}
variable "tags" {
Desscription = "test here"
type = map(string)
default = {}
}
and here is the TF project to use said module:
# Configure the Azure provider
terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = ">= 2.58"
}
}
}
#provider
provider "azurerm" {
features {}
}
module "nsg-main" {
source = "git::git@blahblah.git//nsg-main"
name = "modtest"
location = "westus"
rgname = "tftesting"
tags {
testtag = "true"
thistag = "yes"
}
}