Skip to content

Commit 63a30e4

Browse files
authored
Merge pull request #22 from Think-Cube/patch-1
Delete .terraform-docs.yml
2 parents ea54204 + 6f9e6bd commit 63a30e4

File tree

10 files changed

+176
-142
lines changed

10 files changed

+176
-142
lines changed

.terraform-docs.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

README.md

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,60 @@
1-
<!-- BEGIN_TF_DOCS -->
21
## Requirements
32

43
| Name | Version |
54
|------|---------|
65
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.6.4 |
7-
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 4.0.1 |
6+
| <a name="requirement_azurerm"></a> [azurerm](#requirement\_azurerm) | 4.12.0 |
87

98
## Providers
109

1110
| Name | Version |
1211
|------|---------|
13-
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.0.1 |
12+
| <a name="provider_azurerm"></a> [azurerm](#provider\_azurerm) | 4.12.0 |
13+
14+
## Modules
15+
16+
No modules.
1417

1518
## Resources
1619

1720
| Name | Type |
1821
|------|------|
19-
| [azurerm_bastion_host.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/resources/bastion_host) | resource |
20-
| [azurerm_public_ip.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/resources/public_ip) | resource |
21-
| [azurerm_subnet.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/resources/subnet) | resource |
22-
| [azurerm_virtual_network.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/resources/virtual_network) | resource |
23-
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/data-sources/client_config) | data source |
24-
| [azurerm_resource_group.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/data-sources/resource_group) | data source |
25-
| [azurerm_subnet.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.0.1/docs/data-sources/subnet) | data source |
22+
| [azurerm_bastion_host.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/resources/bastion_host) | resource |
23+
| [azurerm_public_ip.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/resources/public_ip) | resource |
24+
| [azurerm_subnet.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/resources/subnet) | resource |
25+
| [azurerm_virtual_network.main](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/resources/virtual_network) | resource |
26+
| [azurerm_client_config.current](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/data-sources/client_config) | data source |
27+
| [azurerm_resource_group.bastion](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/data-sources/resource_group) | data source |
28+
| [azurerm_resource_group.vnet](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/data-sources/resource_group) | data source |
29+
| [azurerm_subnet.maindata](https://registry.terraform.io/providers/hashicorp/azurerm/4.12.0/docs/data-sources/subnet) | data source |
2630

2731
## Inputs
2832

2933
| Name | Description | Type | Default | Required |
3034
|------|-------------|------|---------|:--------:|
35+
| <a name="input_bastion_host_ip_configuration"></a> [bastion\_host\_ip\_configuration](#input\_bastion\_host\_ip\_configuration) | Block for define Ip configuration for Bastion Host. Changing this forces a new resource to be created. | `string` | `"bastion_config"` | no |
3136
| <a name="input_bastion_hostname"></a> [bastion\_hostname](#input\_bastion\_hostname) | Name of the basion host | `string` | `"test"` | no |
32-
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A mapping of tags to assign to the resource. | `map(any)` | <pre>{<br/> "ManagedByTerraform": "True"<br/>}</pre> | no |
33-
| <a name="input_environment"></a> [environment](#input\_environment) | Variable that defines the name of the environment. | `string` | `"dev"` | no |
37+
| <a name="input_bastion_resource_group_location"></a> [bastion\_resource\_group\_location](#input\_bastion\_resource\_group\_location) | The location/region where the bastion host is created. Changing this forces a new resource to be created. | `string` | `"West Europe"` | no |
38+
| <a name="input_bastion_resource_group_name"></a> [bastion\_resource\_group\_name](#input\_bastion\_resource\_group\_name) | The name of the resource group in which to create the bastion host. | `string` | n/a | yes |
39+
| <a name="input_default_tags"></a> [default\_tags](#input\_default\_tags) | A mapping of tags to assign to the resource. | `map(any)` | n/a | yes |
40+
| <a name="input_environment"></a> [environment](#input\_environment) | Var used for backend container name key | `string` | `"dev"` | no |
3441
| <a name="input_pubip_allocation_method"></a> [pubip\_allocation\_method](#input\_pubip\_allocation\_method) | Defines the allocation method for this IP address. Possible values are Static or Dynamic. | `string` | `"Static"` | no |
3542
| <a name="input_pubip_sku"></a> [pubip\_sku](#input\_pubip\_sku) | The SKU of the Public IP. Accepted values are Basic and Standard. Defaults to Basic. | `string` | `"Standard"` | no |
36-
| <a name="input_region"></a> [region](#input\_region) | Region in which resources are deployed. | `string` | `"weu"` | no |
37-
| <a name="input_resource_group_location"></a> [resource\_group\_location](#input\_resource\_group\_location) | Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created. | `any` | n/a | yes |
38-
| <a name="input_resource_group_name"></a> [resource\_group\_name](#input\_resource\_group\_name) | The name of the resource group in which to create the virtual networn, subnets and bastion host. Changing this forces a new resource to be created. | `any` | n/a | yes |
39-
| <a name="input_subnet_prefix"></a> [subnet\_prefix](#input\_subnet\_prefix) | The address prefix and name to use for the subnet. | `map(any)` | <pre>{<br/> "bastion": {<br/> "ip": [<br/> "10.0.250.0/24"<br/> ],<br/> "name": "AzureBastionSubnet"<br/> },<br/> "subnet_1": {<br/> "ip": [<br/> "10.0.1.0/24"<br/> ],<br/> "name": "Subnet_1"<br/> },<br/> "subnet_2": {<br/> "ip": [<br/> "10.0.2.0/24"<br/> ],<br/> "name": "Subnet_2"<br/> }<br/>}</pre> | no |
43+
| <a name="input_public_ip_name"></a> [public\_ip\_name](#input\_public\_ip\_name) | Specifies the name of the Public IP. Changing this forces a new Public IP to be created. | `string` | `"bastion_pub_ip"` | no |
44+
| <a name="input_region"></a> [region](#input\_region) | Region in which resources are deployed | `string` | `"weu"` | no |
45+
| <a name="input_subnet_prefix"></a> [subnet\_prefix](#input\_subnet\_prefix) | List of subnets with their prefixes and optional service endpoints and delegations | <pre>map(object({<br/> name = string<br/> ip = list(string)<br/> service_endpoints = optional(list(object({<br/> service = string<br/> })), [])<br/> delegations = optional(list(object({<br/> name = string<br/> service_name = string<br/> actions = list(string)<br/> })), [])<br/> private_endpoint_network_policies = optional(string, null)<br/> private_link_service_network_policies_enabled = optional(string, null)<br/> }))</pre> | <pre>{<br/> "example-subnet-1": {<br/> "delegations": [<br/> {<br/> "actions": [<br/> "Microsoft.Network/virtualNetworks/subnets/action"<br/> ],<br/> "name": "delegation1",<br/> "service_name": "Microsoft.Web/serverFarms"<br/> }<br/> ],<br/> "ip": [<br/> "10.0.1.0/24"<br/> ],<br/> "name": "subnet-1",<br/> "private_endpoint_network_policies": "Disabled",<br/> "private_link_service_network_policies_enabled": false,<br/> "service_endpoints": [<br/> {<br/> "service": "Microsoft.Storage"<br/> },<br/> {<br/> "service": "Microsoft.Sql"<br/> }<br/> ]<br/> },<br/> "example-subnet-2": {<br/> "delegations": [<br/> {<br/> "actions": [<br/> "Microsoft.Network/virtualNetworks/subnets/action"<br/> ],<br/> "name": "delegation2",<br/> "service_name": "Microsoft.Web/serverFarms"<br/> }<br/> ],<br/> "ip": [<br/> "10.0.2.0/24"<br/> ],<br/> "name": "subnet-2",<br/> "private_endpoint_network_policies": "Disabled",<br/> "private_link_service_network_policies_enabled": false,<br/> "service_endpoints": [<br/> {<br/> "service": "Microsoft.Storage"<br/> }<br/> ]<br/> }<br/>}</pre> | no |
4046
| <a name="input_vnet_address_space"></a> [vnet\_address\_space](#input\_vnet\_address\_space) | The address space that is used the virtual network. You can supply more than one address space. | `string` | `"10.0.0.0/16"` | no |
4147
| <a name="input_vnet_name"></a> [vnet\_name](#input\_vnet\_name) | The name of the virtual network. Changing this forces a new resource to be created. | `string` | `"VirtualNetwork1"` | no |
48+
| <a name="input_vnet_resource_group_location"></a> [vnet\_resource\_group\_location](#input\_vnet\_resource\_group\_location) | The location/region where the virtual network is created. Changing this forces a new resource to be created. | `string` | `"West Europe"` | no |
49+
| <a name="input_vnet_resource_group_name"></a> [vnet\_resource\_group\_name](#input\_vnet\_resource\_group\_name) | The name of the resource group in which to create the virtual network. | `string` | n/a | yes |
4250

4351
## Outputs
4452

4553
| Name | Description |
4654
|------|-------------|
47-
| <a name="output_bastion_host"></a> [bastion\_host](#output\_bastion\_host) | Information about the bastion host. |
48-
| <a name="output_subnets"></a> [subnets](#output\_subnets) | Information about the subnets within the virtual network. |
49-
| <a name="output_virtual_network"></a> [virtual\_network](#output\_virtual\_network) | Information about the virtual network. |
50-
<!-- END_TF_DOCS -->
55+
| <a name="output_address_space"></a> [address\_space](#output\_address\_space) | The list of address spaces used by the virtual network. |
56+
| <a name="output_bastion_pubip"></a> [bastion\_pubip](#output\_bastion\_pubip) | List the public IP of the bastion server |
57+
| <a name="output_id"></a> [id](#output\_id) | The virtual NetworkConfiguration ID. |
58+
| <a name="output_location"></a> [location](#output\_location) | The location/region where the virtual network is created. |
59+
| <a name="output_name"></a> [name](#output\_name) | The name of the virtual network. |
60+
| <a name="output_resource_group_name"></a> [resource\_group\_name](#output\_resource\_group\_name) | The name of the resource group in which to create the virtual network. |

backend.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
azurerm = {
44
source = "hashicorp/azurerm"
5-
version = "4.0.1"
5+
version = "4.14.0"
66
}
77
}
88
required_version = ">= 1.6.4"

bastion_host.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
data "azurerm_subnet" "main" {
1+
data "azurerm_subnet" "maindata" {
22
name = "AzureBastionSubnet"
33
virtual_network_name = "${var.environment}-${var.vnet_name}-${var.region}-vnet"
4-
resource_group_name = data.azurerm_resource_group.rg.name
4+
resource_group_name = data.azurerm_resource_group.vnet.name
55

66
depends_on = [azurerm_virtual_network.main, azurerm_subnet.main]
77
}
88

99
resource "azurerm_bastion_host" "main" {
10-
name = "${var.environment}-${var.bastion_hostname}-${var.region}-bas"
11-
location = data.azurerm_resource_group.rg.location
12-
resource_group_name = data.azurerm_resource_group.rg.name
10+
name = "${var.environment}-${var.bastion_hostname}-${var.region}-bst"
11+
location = data.azurerm_resource_group.bastion.location
12+
resource_group_name = data.azurerm_resource_group.bastion.name
1313
tags = var.default_tags
1414

1515
ip_configuration {
16-
name = "bastion_config"
17-
subnet_id = data.azurerm_subnet.main.id
16+
name = var.bastion_host_ip_configuration
17+
subnet_id = data.azurerm_subnet.maindata.id
1818
public_ip_address_id = azurerm_public_ip.main.id
1919
}
2020

2121
depends_on = [azurerm_virtual_network.main, azurerm_subnet.main, data.azurerm_subnet.maindata]
22-
}
22+
}

main.tf

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
data "azurerm_client_config" "current" {}
22

3-
data "azurerm_resource_group" "main" {
4-
name = var.resource_group_name
5-
}
3+
data "azurerm_resource_group" "vnet" {
4+
name = var.vnet_resource_group_name
5+
}
6+
7+
data "azurerm_resource_group" "bastion" {
8+
name = var.bastion_resource_group_name
9+
}

output.tf

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,30 @@
1-
output "virtual_network" {
2-
description = "Information about the virtual network."
3-
value = {
4-
name = azurerm_virtual_network.main.name
5-
id = azurerm_virtual_network.main.id
6-
address_space = azurerm_virtual_network.main.address_space
7-
}
8-
sensitive = false
1+
output "id" {
2+
description = "The virtual NetworkConfiguration ID."
3+
value = azurerm_virtual_network.main.id
4+
sensitive = false
95
}
10-
11-
output "subnets" {
12-
description = "Information about the subnets within the virtual network."
13-
value = {
14-
for subnet_name, subnet in azurerm_subnet.main : subnet_name => {
15-
name = subnet.name
16-
id = subnet.id
17-
address_prefixes = subnet.address_prefixes
18-
}
19-
}
20-
sensitive = false
6+
output "name" {
7+
description = "The name of the virtual network."
8+
value = azurerm_virtual_network.main.name
9+
sensitive = false
2110
}
22-
23-
output "bastion_host" {
24-
description = "Information about the bastion host."
25-
value = {
26-
name = azurerm_bastion_host.main.name
27-
private_ip = azurerm_bastion_host.main.ip_configuration[0].private_ip_address
28-
public_ip = azurerm_public_ip.main.ip_address
29-
bastion_subnet = azurerm_bastion_host.main.ip_configuration[0].subnet_id
30-
}
31-
sensitive = false
11+
output "resource_group_name" {
12+
description = "The name of the resource group in which to create the virtual network."
13+
value = azurerm_virtual_network.main.resource_group_name
14+
sensitive = false
15+
}
16+
output "location" {
17+
description = "The location/region where the virtual network is created."
18+
value = azurerm_virtual_network.main.location
19+
sensitive = false
20+
}
21+
output "address_space" {
22+
description = "The list of address spaces used by the virtual network."
23+
value = azurerm_virtual_network.main.address_space
24+
sensitive = false
25+
}
26+
output "bastion_pubip" {
27+
value = azurerm_public_ip.main.ip_address
28+
description = "List the public IP of the bastion server"
29+
sensitive = false
3230
}

publicip.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
resource "azurerm_public_ip" "main" {
2-
name = "${var.environment}-${var.bastion_hostname}-${var.region}-pip"
3-
location = data.azurerm_resource_group.rg.location
4-
resource_group_name = data.azurerm_resource_group.rg.name
2+
name = "${var.environment}-${var.public_ip_name}"
3+
location = data.azurerm_resource_group.bastion.location
4+
resource_group_name = data.azurerm_resource_group.bastion.name
55
allocation_method = var.pubip_allocation_method
66
sku = var.pubip_sku
77
tags = var.default_tags

subnet.tf

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
11
resource "azurerm_subnet" "main" {
22
for_each = var.subnet_prefix
3-
resource_group_name = data.azurerm_resource_group.rg.name
3+
resource_group_name = data.azurerm_resource_group.vnet.name
44
virtual_network_name = "${var.environment}-${var.vnet_name}-${var.region}-vnet"
55
name = each.value["name"]
66
address_prefixes = each.value["ip"]
7-
8-
depends_on = [azurerm_virtual_network.main]
9-
}
7+
service_endpoints = [for se in lookup(each.value, "service_endpoints", []) : se.service]
8+
dynamic "delegation" {
9+
for_each = lookup(each.value, "delegations", [])
10+
content {
11+
name = delegation.value.name
12+
service_delegation {
13+
name = delegation.value.service_name
14+
actions = delegation.value.actions
15+
}
16+
}
17+
}
18+
private_endpoint_network_policies = lookup(each.value, "private_endpoint_network_policies", null)
19+
private_link_service_network_policies_enabled = lookup(each.value, "private_link_service_network_policies_enabled", null)
20+
depends_on = [azurerm_virtual_network.main]
21+
}

0 commit comments

Comments
 (0)