Skip to content

Commit

Permalink
move subnet_id, subnet_key and vnet_key to top level where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
FoSix committed Jan 29, 2024
1 parent 1fbde62 commit 044a90d
Show file tree
Hide file tree
Showing 35 changed files with 460 additions and 420 deletions.
46 changes: 23 additions & 23 deletions examples/appgw/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,45 +164,45 @@ represents the Rules section of an Application Gateway in Azure Portal.

Below you can find a brief list of available properties:

- `name` - (`string`, required) the name of the Application Gateway, will be prefixed with `var.name_prefix`
- `name` - (`string`, required) the name of the Application Gateway, will be prefixed with `var.name_prefix`
- `subnet_key` - (`string`, required) a key pointing to a Subnet definition in the `var.vnets` map, this has to be an
Application Gateway V2 dedicated subnet.
- `vnet_key` - (`string`, required) a key pointing to a VNET definition in the `var.vnets` map that stores the Subnet
described by `subnet_key`.
- `application_gateway` - (`map`, required) defines the basic Application Gateway settings, for details see
[module's documentation](../../modules/appgw/README.md#application_gateway). The most important
properties are:
- `subnet_key` - (`string`, required) a key pointing to a Subnet definition in the `var.vnets` map, this has to be an
Application Gateway V2 dedicated subnet.
- `vnet_key` - (`string`, required) a key pointing to a VNET definition in the `var.vnets` map that stores the Subnet
described by `subnet_key`.
- `public_ip` - (`map`, required) defines a Public IP resource used by the Application Gateway instance, a newly created
Public IP will have it's name prefixes with `var.name_prefix`
- `zones` - (`list`, optional, defaults to module defaults) parameter controlling if this is a zonal, or a non-zonal
deployment
- `backend_pool` - (`map`, optional, defaults to module defaults) backend pool definition, when skipped, an empty backend
will be created
- `listeners` - (`map`, required) defines Application Gateway's Listeners, see
[module's documentation](../../modules/appgw/README.md#listeners) for details
- `backends` - (`map`, optional, mutually exclusive with `redirects` and `url_path_maps`) defines HTTP backend settings,
see [module's documentation](../../modules/appgw/README.md#backends) for details
- `probes` - (`map`, optional, defaults to module defaults) defines backend probes used check health of backends,
see [module's documentation](../../modules/appgw/README.md#probes) for details
- `rewrites` - (`map`, optional, defaults to module defaults) defines rewrite rules,
see [module's documentation](../../modules/appgw/README.md#rewrites) for details
- `redirects - (`map`, optional, mutually exclusive with `backends` and `url_path_maps`) static redirects definition,
see [module's documentation](../../modules/appgw/README.md#redirects) for details
- `url_path_maps - (`map`, optional, mutually exclusive with `backends` and `redirects`) URL path maps definition,
see [module's documentation](../../modules/appgw/README.md#url_path_maps) for details
- `rules - (`map`, required) Application Gateway Rules definition, bind together a `listener` with either `backend`,
`redirect` or `url_path_map`, see [module's documentation](../../modules/appgw/README.md#rules)
for details
- `listeners` - (`map`, required) defines Application Gateway's Listeners, see
[module's documentation](../../modules/appgw/README.md#listeners) for details
- `backends` - (`map`, optional, mutually exclusive with `redirects` and `url_path_maps`) defines HTTP backend
settings, see [module's documentation](../../modules/appgw/README.md#backends) for details
- `probes` - (`map`, optional, defaults to module defaults) defines backend probes used check health of backends,
see [module's documentation](../../modules/appgw/README.md#probes) for details
- `rewrites` - (`map`, optional, defaults to module defaults) defines rewrite rules,
see [module's documentation](../../modules/appgw/README.md#rewrites) for details
- `redirects - (`map`, optional, mutually exclusive with `backends` and `url_path_maps`) static redirects definition,
see [module's documentation](../../modules/appgw/README.md#redirects) for details
- `url_path_maps - (`map`, optional, mutually exclusive with `backends` and `redirects`) URL path maps definition,
see [module's documentation](../../modules/appgw/README.md#url_path_maps) for details
- `rules - (`map`, required) Application Gateway Rules definition, bind together a `listener` with either
`backend`, `redirect` or `url_path_map`, see
[module's documentation](../../modules/appgw/README.md#rules) for details


Type:

```hcl
map(object({
name = string
name = string
vnet_key = string
subnet_key = string
application_gateway = object({
vnet_key = string
subnet_key = string
public_ip = object({
name = string
resource_group_name = optional(string)
Expand Down
48 changes: 24 additions & 24 deletions examples/appgw/example.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ vnets = {

appgws = {
"public-empty" = {
name = "empty"
name = "empty"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
vnet_key = "transit"
subnet_key = "appgw"
public_ip = {
name = "public-empty-ip"
}
Expand Down Expand Up @@ -71,14 +71,14 @@ appgws = {
}
}
"public-http-minimum" = {
name = "appgw-http-minimum"
name = "appgw-http-minimum"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
public_ip = {
name = "pip-http-minimum"
}
vnet_key = "transit"
subnet_key = "appgw"
zones = []
zones = []
}
listeners = {
minimum = {
Expand Down Expand Up @@ -124,10 +124,10 @@ appgws = {
name = "pip-existing"
create = false
}
vnet_key = "transit"
subnet_key = "appgw"
zones = ["1"]
zones = ["1"]
}
vnet_key = "transit"
subnet_key = "appgw"
backends = {
existing = {
name = "http-backend"
Expand Down Expand Up @@ -168,14 +168,14 @@ appgws = {
}
}
"public-http-autoscale" = {
name = "appgw-http-autoscale"
name = "appgw-http-autoscale"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
public_ip = {
name = "pip-http-autoscale"
}
vnet_key = "transit"
subnet_key = "appgw"
zones = null
zones = null
capacity = {
autoscale = {
min = 2
Expand Down Expand Up @@ -209,14 +209,14 @@ appgws = {
}
}
"public-waf" = {
name = "appgw-waf"
name = "appgw-waf"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
public_ip = {
name = "pip-waf"
}
vnet_key = "transit"
subnet_key = "appgw"
zones = []
zones = []
capacity = {
static = 4
}
Expand Down Expand Up @@ -280,7 +280,9 @@ appgws = {
# openssl pkcs12 -inkey test1.key -in test1.crt -export -out test1.pfx
# openssl pkcs12 -inkey test2.key -in test2.crt -export -out test2.pfx
"public-ssl-custom" = {
name = "appgw-ssl-custom"
name = "appgw-ssl-custom"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
public_ip = {
name = "pip-ssl-custom"
Expand All @@ -289,8 +291,6 @@ appgws = {
name = "vmseries-pool"
}
frontend_ip_configuration_name = "public_ipconfig"
vnet_key = "transit"
subnet_key = "appgw"
zones = ["1", "2", "3"]
global_ssl_policy = {
type = "Custom"
Expand Down Expand Up @@ -598,13 +598,13 @@ appgws = {
}
}
"public-ssl-predefined" = {
name = "appgw-ssl-predefined"
name = "appgw-ssl-predefined"
vnet_key = "transit"
subnet_key = "appgw"
application_gateway = {
public_ip = {
name = "pip-ssl-predefined"
}
vnet_key = "transit"
subnet_key = "appgw"
backend_pool = {
name = "vmseries-pool-custom"
}
Expand Down
2 changes: 1 addition & 1 deletion examples/appgw/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ module "appgw" {
name = "${var.name_prefix}${each.value.name}"
resource_group_name = local.resource_group.name
location = var.location
subnet_id = module.vnet[each.value.vnet_key].subnet_ids[each.value.subnet_key]

application_gateway = merge(
each.value.application_gateway,
{
subnet_id = module.vnet[each.value.application_gateway.vnet_key].subnet_ids[each.value.application_gateway.subnet_key]
public_ip = merge(
each.value.application_gateway.public_ip,
{
Expand Down
46 changes: 23 additions & 23 deletions examples/appgw/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -128,41 +128,41 @@ variable "appgws" {
Below you can find a brief list of available properties:
- `name` - (`string`, required) the name of the Application Gateway, will be prefixed with `var.name_prefix`
- `name` - (`string`, required) the name of the Application Gateway, will be prefixed with `var.name_prefix`
- `subnet_key` - (`string`, required) a key pointing to a Subnet definition in the `var.vnets` map, this has to be an
Application Gateway V2 dedicated subnet.
- `vnet_key` - (`string`, required) a key pointing to a VNET definition in the `var.vnets` map that stores the Subnet
described by `subnet_key`.
- `application_gateway` - (`map`, required) defines the basic Application Gateway settings, for details see
[module's documentation](../../modules/appgw/README.md#application_gateway). The most important
properties are:
- `subnet_key` - (`string`, required) a key pointing to a Subnet definition in the `var.vnets` map, this has to be an
Application Gateway V2 dedicated subnet.
- `vnet_key` - (`string`, required) a key pointing to a VNET definition in the `var.vnets` map that stores the Subnet
described by `subnet_key`.
- `public_ip` - (`map`, required) defines a Public IP resource used by the Application Gateway instance, a newly created
Public IP will have it's name prefixes with `var.name_prefix`
- `zones` - (`list`, optional, defaults to module defaults) parameter controlling if this is a zonal, or a non-zonal
deployment
- `backend_pool` - (`map`, optional, defaults to module defaults) backend pool definition, when skipped, an empty backend
will be created
- `listeners` - (`map`, required) defines Application Gateway's Listeners, see
[module's documentation](../../modules/appgw/README.md#listeners) for details
- `backends` - (`map`, optional, mutually exclusive with `redirects` and `url_path_maps`) defines HTTP backend settings,
see [module's documentation](../../modules/appgw/README.md#backends) for details
- `probes` - (`map`, optional, defaults to module defaults) defines backend probes used check health of backends,
see [module's documentation](../../modules/appgw/README.md#probes) for details
- `rewrites` - (`map`, optional, defaults to module defaults) defines rewrite rules,
see [module's documentation](../../modules/appgw/README.md#rewrites) for details
- `redirects - (`map`, optional, mutually exclusive with `backends` and `url_path_maps`) static redirects definition,
see [module's documentation](../../modules/appgw/README.md#redirects) for details
- `url_path_maps - (`map`, optional, mutually exclusive with `backends` and `redirects`) URL path maps definition,
see [module's documentation](../../modules/appgw/README.md#url_path_maps) for details
- `rules - (`map`, required) Application Gateway Rules definition, bind together a `listener` with either `backend`,
`redirect` or `url_path_map`, see [module's documentation](../../modules/appgw/README.md#rules)
for details
- `listeners` - (`map`, required) defines Application Gateway's Listeners, see
[module's documentation](../../modules/appgw/README.md#listeners) for details
- `backends` - (`map`, optional, mutually exclusive with `redirects` and `url_path_maps`) defines HTTP backend
settings, see [module's documentation](../../modules/appgw/README.md#backends) for details
- `probes` - (`map`, optional, defaults to module defaults) defines backend probes used check health of backends,
see [module's documentation](../../modules/appgw/README.md#probes) for details
- `rewrites` - (`map`, optional, defaults to module defaults) defines rewrite rules,
see [module's documentation](../../modules/appgw/README.md#rewrites) for details
- `redirects - (`map`, optional, mutually exclusive with `backends` and `url_path_maps`) static redirects definition,
see [module's documentation](../../modules/appgw/README.md#redirects) for details
- `url_path_maps - (`map`, optional, mutually exclusive with `backends` and `redirects`) URL path maps definition,
see [module's documentation](../../modules/appgw/README.md#url_path_maps) for details
- `rules - (`map`, required) Application Gateway Rules definition, bind together a `listener` with either
`backend`, `redirect` or `url_path_map`, see
[module's documentation](../../modules/appgw/README.md#rules) for details
EOF
type = map(object({
name = string
name = string
vnet_key = string
subnet_key = string
application_gateway = object({
vnet_key = string
subnet_key = string
public_ip = object({
name = string
resource_group_name = optional(string)
Expand Down
Loading

0 comments on commit 044a90d

Please sign in to comment.