Skip to content

Commit

Permalink
Merge pull request #6 from Nepomuceno/firewalladd
Browse files Browse the repository at this point in the history
Adding firewall and basic makefile
  • Loading branch information
jjcollinge authored Jun 16, 2020
2 parents 1c80853 + f41d535 commit 5f16970
Show file tree
Hide file tree
Showing 11 changed files with 1,007 additions and 138 deletions.
28 changes: 28 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.POSIX:

.PHONY: all
all: build format validate

.PHONY: install
install:
command -v terraform >/dev/null 2>&1 || GO111MODULE="on" go get github.com/hashicorp/[email protected]
command -v terraform-docs >/dev/null 2>&1 || GO111MODULE="on" go get github.com/segmentio/[email protected]
command -v tfsec >/dev/null 2>&1 || GO111MODULE="on" go get github.com/liamg/tfsec/cmd/[email protected]
command -v tflint >/dev/null 2>&1 || GO111MODULE="on" go get github.com/terraform-linters/[email protected]

.PHONY: build
build: install generate

.PHONY: generate
generate:
go run main.go

.PHONY: format
format:
terraform fmt

.PHONY: validate
validate:
terraform fmt --check
terraform validate -no-color
tflint --no-color
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ You can find a list bellow of all the resources that are currently implemented.
| express\_route\_circuit | n/a |
| express\_route\_gateway | n/a |
| firewall | n/a |
| firewall\_application\_rule\_collection | n/a |
| firewall\_ip\_configuration | n/a |
| firewall\_nat\_rule\_collection | n/a |
| firewall\_network\_rule\_collection | n/a |
| frontdoor | n/a |
| frontdoor\_firewall\_policy | n/a |
| hdinsight\_hadoop\_cluster | n/a |
Expand Down
4 changes: 0 additions & 4 deletions docs/not_defined.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
- virtual_hub_connection
- virtual_network_gateway_connection
- vpn_server_configuration
- firewall_ip_configuration
- firewall_application_rule_collection
- firewall_nat_rule_collection
- firewall_network_rule_collection
- monitor_action_group
- monitor_action_rule_action_group
- monitor_action_rule_suppression
Expand Down
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@ module github.com/azure/terraform-azurerm-naming

go 1.13

require muzzammil.xyz/jsonc v0.0.0-20200303171503-1e787b591db7
require (
github.com/liamg/tfsec v0.21.0 // indirect
github.com/terraform-linters/tflint v0.16.2 // indirect
)
754 changes: 754 additions & 0 deletions go.sum

Large diffs are not rendered by default.

12 changes: 4 additions & 8 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ import (
"log"
"os"
"text/template"

"muzzammil.xyz/jsonc"
)

// Resource definityion for the package
Expand Down Expand Up @@ -40,25 +38,23 @@ func main() {
log.Fatal(err)
}

sourceDefinitions, err := ioutil.ReadFile("resourceDefinition.jsonc")
sourceDefinitions, err := ioutil.ReadFile("resourceDefinition.json")
if err != nil {
log.Fatal(err)
}
var data []Resource
jc := jsonc.ToJSON(sourceDefinitions)
err = json.Unmarshal(jc, &data)
err = json.Unmarshal(sourceDefinitions, &data)
if err != nil {
log.Fatal(err)
}

// Undocumented resource definitions
sourceDefinitionsUndocumented, err := ioutil.ReadFile("resourceDefinition_out_of_docs.jsonc")
sourceDefinitionsUndocumented, err := ioutil.ReadFile("resourceDefinition_out_of_docs.json")
if err != nil {
log.Fatal(err)
}
var dataUndocumented []Resource
jcUndoc := jsonc.ToJSON(sourceDefinitionsUndocumented)
err = json.Unmarshal(jcUndoc, &dataUndocumented)
err = json.Unmarshal(sourceDefinitionsUndocumented, &dataUndocumented)
if err != nil {
log.Fatal(err)
}
Expand Down
40 changes: 40 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1661,5 +1661,45 @@ locals {
scope = "resourceGroup"
regex = "/^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9\\-\\._]+[a-zA-Z0-9_]$/"
}
firewall_ip_configuration = {
name = substr(join("-", compact([local.prefix, "fwipconf", local.suffix])), 0, 80)
name_unique = substr(join("-", compact([local.prefix, "fwipconf", local.suffix_unique])), 0, 80)
dashes = true
slug = "fwipconf"
min_length = 1
max_length = 80
scope = "resourceGroup"
regex = "/^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9\\-\\._]+[a-zA-Z0-9_]$/"
}
firewall_application_rule_collection = {
name = substr(join("-", compact([local.prefix, "fwapp", local.suffix])), 0, 80)
name_unique = substr(join("-", compact([local.prefix, "fwapp", local.suffix_unique])), 0, 80)
dashes = true
slug = "fwapp"
min_length = 1
max_length = 80
scope = "parent"
regex = "/^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9\\-\\._]+[a-zA-Z0-9_]$/"
}
firewall_nat_rule_collection = {
name = substr(join("-", compact([local.prefix, "fwnatrc", local.suffix])), 0, 80)
name_unique = substr(join("-", compact([local.prefix, "fwnatrc", local.suffix_unique])), 0, 80)
dashes = true
slug = "fwnatrc"
min_length = 1
max_length = 80
scope = "parent"
regex = "/^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9\\-\\._]+[a-zA-Z0-9_]$/"
}
firewall_network_rule_collection = {
name = substr(join("-", compact([local.prefix, "fwnetrc", local.suffix])), 0, 80)
name_unique = substr(join("-", compact([local.prefix, "fwnetrc", local.suffix_unique])), 0, 80)
dashes = true
slug = "fwnetrc"
min_length = 1
max_length = 80
scope = "parent"
regex = "/^(?=.{1,80}$)[a-zA-Z0-9][a-zA-Z0-9\\-\\._]+[a-zA-Z0-9_]$/"
}
}
}
16 changes: 16 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -654,4 +654,20 @@ output "private_service_connection" {
value = local.az.private_service_connection
}

output "firewall_ip_configuration" {
value = local.az.firewall_ip_configuration
}

output "firewall_application_rule_collection" {
value = local.az.firewall_application_rule_collection
}

output "firewall_nat_rule_collection" {
value = local.az.firewall_nat_rule_collection
}

output "firewall_network_rule_collection" {
value = local.az.firewall_network_rule_collection
}


Loading

0 comments on commit 5f16970

Please sign in to comment.