Skip to content

Commit 803589d

Browse files
authored
feat: Added vnet terraform module (#2)
* feat: Added vnet terraform module code with updated chhanges * fix: Updated labels module call * fix: Removed readme and changelog workflows * fix: updated terraform-diff workflow * fix: Added README for examples and updated resource group module reference * fix: handle null instead of empty string for custom_name fallback * fix: Updated repository reference * fix: updated variables and examples * fix: updated readme.yaml * fix: updated encryption variable name and gitignore * fix: updated least supported version * fix: updated location to tackle terraform plan validation issue
1 parent 2a9b859 commit 803589d

24 files changed

+640
-87
lines changed

.github/dependabot.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ updates:
1212
interval: "daily"
1313
open-pull-requests-limit: 3
1414
assignees:
15-
- "@terraform-az-modules/crew"
15+
- "clouddrove-ci"
1616
reviewers:
1717
- "approvers"
1818
- "Crew"
@@ -23,7 +23,7 @@ updates:
2323
interval: "daily"
2424
# Add assignees
2525
assignees:
26-
- "@terraform-az-modules/crew"
26+
- "clouddrove-ci"
2727
# Add reviewer
2828
reviewers:
2929
- "approvers"
@@ -37,10 +37,24 @@ updates:
3737
interval: "daily"
3838
# Add assignees
3939
assignees:
40-
- "@terraform-az-modules/crew"
40+
- "clouddrove-ci"
4141
# Add reviewer
4242
reviewers:
4343
- "approvers"
4444
- "Crew"
4545
# Allow up to 3 open pull requests for pip dependencies
4646
open-pull-requests-limit: 3
47+
48+
- package-ecosystem: "terraform" # See documentation for possible values
49+
directory: "/examples/vnet_with_existing_ddos_id" # Location of package manifests
50+
schedule:
51+
interval: "daily"
52+
# Add assignees
53+
assignees:
54+
- "clouddrove-ci"
55+
# Add reviewer
56+
reviewers:
57+
- "approvers"
58+
- "Crew"
59+
# Allow up to 3 open pull requests for pip dependencies
60+
open-pull-requests-limit: 3

.github/workflows/auto_assignee.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ jobs:
1111
secrets:
1212
GITHUB: ${{ secrets.GITHUB }}
1313
with:
14-
assignees: 'author'
14+
assignees: 'clouddrove-ci'
1515
reviewers: '@terraform-az-modules/crew'
1616

.github/workflows/changelog.yml

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

.github/workflows/readme.yml

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

.github/workflows/terraform-diff.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ on:
33
pull_request:
44
branches:
55
- master
6-
paths:
7-
- 'examples/complete/**'
86

97
jobs:
10-
# Update 'Job name' and 'terraform_directory' as needed based on the module structure.
118
complete-example:
129
uses: clouddrove/github-shared-workflows/.github/workflows/tf-pr-checks.yaml@master
1310
with:
1411
provider: 'azurerm'
1512
terraform_directory: 'examples/complete'
1613
target_branch: 'master'
14+
secrets:
15+
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
16+
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
17+
18+
vnet-with-existing-ddos-id-example:
19+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-pr-checks.yaml@master
20+
with:
21+
provider: 'azurerm'
22+
terraform_directory: 'examples/vnet_with_existing_ddos_id'
23+
target_branch: 'master'
1724
secrets:
1825
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
1926
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}

.github/workflows/tf-checks.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,18 @@ on:
55
pull_request:
66
workflow_dispatch:
77
jobs:
8-
# Update 'Job name' and 'working_directory' as needed based on the module structure.
98
complete-example:
10-
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@1.3.3
9+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
1110
with:
1211
working_directory: './examples/complete/'
12+
13+
vnet_with_existing_ddos_id-example:
14+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-checks.yml@master
15+
with:
16+
working_directory: './examples/vnet_with_existing_ddos_id/'
1317

1418
# Seperate Job for TFlint workflow call
1519
tf-lint:
16-
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@1.3.3
20+
uses: clouddrove/github-shared-workflows/.github/workflows/tf-lint.yml@master
1721
secrets:
1822
GITHUB: ${{ secrets.GITHUB }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ override.tf.json
3535
# Ignore CLI configuration files
3636
.terraformrc
3737
terraform.rc
38+
.terraform.lock.hcl

README.md

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<!-- This file was automatically generated by the `geine`. Make all changes to `README.yaml` and run `make readme` to rebuild this file. -->
2-
<p align="center">
3-
<img src="https://github.com/user-attachments/assets/5b2ab201-5926-46fa-b0a2-07a6f406ab6d" alt="Banner" />
4-
</p>
52
<h1 align="center">
63
Terraform Azure Module Template
74
</h1>
@@ -65,26 +62,48 @@ This table contains both Prerequisites and Providers:
6562

6663
## Examples
6764

68-
**IMPORTANT:** Since the master branch used in source varies based on new modifications, we recommend using the [release versions](https://github.com/terraform-az-modules/terraform-module-template/releases).
65+
**IMPORTANT:** Since the master branch used in source varies based on new modifications, we recommend using the [release versions](https://github.com/terraform-az-modules/terraform-azure-vnet/releases).
6966

7067
📌 For additional usage examples, check the complete list under [`examples/`](./examples) directory.
7168

7269

7370

71+
Here is the **Inputs and Outputs** section for your **VNet module** in clean and consistent README format, based on the inputs and outputs you've provided:
72+
73+
7474
## Inputs and Outputs
7575

7676
### Inputs
7777

78-
| Name | Description | Type | Default | Required |
79-
|------|-------------|------|---------|:--------:|
80-
| label_order | Label order, e.g. `name`,`application`,`centralus`. | `list(any)` | <pre>["name","environment", "location"]</pre> | no |
78+
| Name | Description | Type | Default | Required |
79+
| -------------------------- | ------------------------------------------------------------------------------------- | -------------- | ----------------------------------------------- | :------: |
80+
| name | Name of the Virtual Network. | `string` | n/a | yes |
81+
| environment | Environment name (e.g., dev, prod). | `string` | n/a | yes |
82+
| label\_order | Label order used in naming resources. | `list(any)` | <pre>\["name", "environment", "location"]</pre> | no |
83+
| resource\_group\_name | Name of the resource group where the Virtual Network will be deployed. | `string` | n/a | yes |
84+
| location | Azure region where the Virtual Network will be deployed. | `string` | n/a | yes |
85+
| address\_spaces | List of address spaces to be used for the Virtual Network. | `list(string)` | n/a | yes |
86+
| resource\_position\_prefix | If true, adds resource type prefix (e.g., `vnet-`) to resource name; else appends it. | `bool` | `true` | no |
87+
| enable\_ddos\_pp | Set to true to create a new DDoS Protection Plan. | `bool` | `false` | no |
88+
| existing\_ddos\_pp | ID of an existing DDoS Protection Plan to associate with the Virtual Network. | `string` | `null` | no |
89+
| enable\_network\_watcher | Set to true to enable deployment of Network Watcher. | `bool` | `false` | no |
90+
91+
---
8192

8293
### Outputs
8394

84-
| Name | Description |
85-
|------|-------------|
86-
| label_order | Label order, e.g. `name`,`application`,`centralus`. |
87-
95+
| Name | Description |
96+
| -------------------------- | ----------------------------------------------------------------------------------------------- |
97+
| vnet\_id | The ID of the newly created Virtual Network. |
98+
| vnet\_name | The name of the newly created Virtual Network. |
99+
| vnet\_location | The location of the newly created Virtual Network. |
100+
| vnet\_address\_space | The address space of the newly created Virtual Network. |
101+
| vnet\_guid | The GUID of the Virtual Network. |
102+
| vnet\_rg\_name | The name of the resource group containing the Virtual Network. |
103+
| ddos\_protection\_plan\_id | The ID of the newly created DDoS Protection Plan (if created). |
104+
| ddos\_existing\_plan\_id | The ID of the DDoS Protection Plan associated with the Virtual Network (if using existing one). |
105+
| network\_watcher\_id | The ID of the Network Watcher (if deployed). |
106+
| network\_watcher\_name | The name of the Network Watcher (if deployed). |
88107

89108

90109
<!--
@@ -100,6 +119,7 @@ This module has dependencies on:
100119

101120
This module has dependencies on:
102121
- [Labels Module](https://github.com/terraform-az-modules/terraform-azure-tags): Provides resource tagging.
122+
- Resource Group Module: Responsible for creating and managing Azure Resource Groups to organize and group related resources consistently across environments.
103123

104124

105125
## 📑 Changelog
@@ -113,8 +133,8 @@ Refer [here](CHANGELOG.md).
113133

114134
Big thanks to our contributors for elevating our project with their dedication and expertise! But, we do not wish to stop there, would like to invite contributions from the community in improving these projects and making them more versatile for better reach. Remember, every bit of contribution is immensely valuable, as, together, we are moving in only 1 direction, i.e. forward.
115135

116-
<a href="https://github.com/terraform-az-modules/terraform-azure-module-template/graphs/contributors">
117-
<img src="https://contrib.rocks/image?repo=terraform-az-modules/terraform-azure-module-template&max" />
136+
<a href="https://github.com/terraform-az-modules/terraform-azure-vnet/graphs/contributors">
137+
<img src="https://contrib.rocks/image?repo=terraform-az-modules/terraform-azure-vnet&max" />
118138
</a>
119139
<br>
120140
<br>
@@ -129,9 +149,9 @@ Big thanks to our contributors for elevating our project with their dedication a
129149

130150

131151
## Feedback
132-
Spot a bug or have thoughts to share with us? Let's squash it together! Log it in our [issue tracker](https://github.com/terraform-az-modules/terraform-azure-module-template/issues), feel free to drop us an email at [[email protected]]([email protected])).
152+
Spot a bug or have thoughts to share with us? Let's squash it together! Log it in our [issue tracker](https://github.com/terraform-az-modules/terraform-azure-vnet/issues), feel free to drop us an email at [[email protected]]([email protected])).
133153

134-
Show some love with a ★ on [our GitHub](https://github.com/terraform-az-modules/terraform-azure-module-template)! if our work has brightened your day! – your feedback fuels our journey!
154+
Show some love with a ★ on [our GitHub](https://github.com/terraform-az-modules/terraform-azure-vnet)! if our work has brightened your day! – your feedback fuels our journey!
135155

136156

137157
## :rocket: Our Accomplishment

README.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
#
66

77
# Name of this project
8-
name : Terraform Azure Module Template
8+
name : Terraform Azure VNet
99

1010
# License of this project
1111
license: "APACHE"
1212

1313
# Canonical GitHub repo
14-
github_repo: terraform-az-modules/terraform-module-template
14+
github_repo: terraform-az-modules/terraform-azure-vnet
1515

1616
# Badges to display
1717
badges:
@@ -38,7 +38,7 @@ providers:
3838

3939
# description of this project
4040
description: |-
41-
Terraform Azure Module Template to create new modules using this as baseline
41+
Terraform Azure Virtual Network (VNet) module is a Terraform module that allows you to create and manage Azure Virtual Networks.
4242
4343
# How to use this project
4444
# How to use this project

examples/complete/README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- BEGIN_TF_DOCS -->
2+
3+
# Azure Virtual Network (vNet) Module
4+
5+
This example demonstrates how to use the `terraform-azure-vnet` module to deploy an Azure Virtual Network.
6+
7+
---
8+
9+
## ✅ Requirements
10+
11+
| Name | Version |
12+
|-----------|-----------|
13+
| Terraform | >= 1.6.6 |
14+
| Azurerm | >= 3.90.0 |
15+
16+
---
17+
18+
## 🔌 Providers
19+
20+
No providers are explicitly defined in this example.
21+
22+
---
23+
24+
## 📦 Modules
25+
26+
| Name | Source | Version |
27+
|-----------------|-------------------------------------|---------|
28+
| resource_group | terraform-az-modules/resource-group/azure | 1.0.0 |
29+
| vnet | ../../ | n/a |
30+
31+
---
32+
33+
## 🏗️ Resources
34+
35+
No additional resources are directly created in this example.
36+
37+
---
38+
39+
## 🔧 Inputs
40+
41+
_No input variables are defined in this example._
42+
43+
---
44+
45+
## 📤 Outputs
46+
47+
| Name | Description |
48+
|-----------------------------|-----------------------------------------------------------------------------|
49+
| `ddos_protection_plan_id` | The ID of the DDoS Protection Plan |
50+
| `vnet_address_space` | The address space of the newly created vNet |
51+
| `vnet_guid` | The GUID of the virtual network |
52+
| `vnet_id` | The ID of the newly created vNet |
53+
| `vnet_location` | The location of the newly created vNet |
54+
| `vnet_name` | The name of the newly created vNet |
55+
| `vnet_rg_name` | The name of the resource group in which the vNet is created. Changing this forces a new resource to be created. |
56+
57+
<!-- END_TF_DOCS -->

0 commit comments

Comments
 (0)