Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
make var.use_for_each a required variable
Browse files Browse the repository at this point in the history
  • Loading branch information
lonegunmanb committed Dec 8, 2022
1 parent 7735cce commit 692af67
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 70 deletions.
62 changes: 62 additions & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Changelog

## [3.2.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.2.0) (2022-12-08)

**Merged pull requests:**

- Add new variable `use_for_each` so we can use `for_each` to create multiple resource instances. [\#92](https://github.com/Azure/terraform-azurerm-vnet/pull/92) ([lonegunmanb](https://github.com/lonegunmanb))

## [3.1.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.1.0) (2022-12-07)

**Merged pull requests:**

- Bump tflint plugin version, add new rule [\#91](https://github.com/Azure/terraform-azurerm-vnet/pull/91) ([lonegunmanb](https://github.com/lonegunmanb))
- Ci updating breaking-change-detect [\#90](https://github.com/Azure/terraform-azurerm-vnet/pull/90) ([Pumpkin-3906](https://github.com/Pumpkin-3906))
- Upgrade `terraform-module-test-helper` lib so we can get rid of override file to execute version upgrade test [\#89](https://github.com/Azure/terraform-azurerm-vnet/pull/89) ([lonegunmanb](https://github.com/lonegunmanb))
- Add support for `bgp_community` [\#88](https://github.com/Azure/terraform-azurerm-vnet/pull/88) ([lonegunmanb](https://github.com/lonegunmanb))
- update outputs.tf to bracket syntax [\#86](https://github.com/Azure/terraform-azurerm-vnet/pull/86) ([Pumpkin-3906](https://github.com/Pumpkin-3906))
- Add update changelog step in CI pipeline, update pull request template [\#82](https://github.com/Azure/terraform-azurerm-vnet/pull/82) ([lonegunmanb](https://github.com/lonegunmanb))
- Bump test helper version [\#79](https://github.com/Azure/terraform-azurerm-vnet/pull/79) ([lonegunmanb](https://github.com/lonegunmanb))

## [3.0.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.0.0) (2022-10-18)

**Implemented enhancements:**

- Allow configure enforce\_private\_link\_endpoint\_network\_policies and enforce\_private\_link\_service\_network\_policies params for subnets [\#40](https://github.com/Azure/terraform-azurerm-vnet/pull/40) ([mathsnunes](https://github.com/mathsnunes))

**Merged pull requests:**

- Add a CI step to detect potential breaking changes. [\#75](https://github.com/Azure/terraform-azurerm-vnet/pull/75) ([lonegunmanb](https://github.com/lonegunmanb))
- Limit `azurerm`'s version to `>= 3.11, < 4.0` [\#74](https://github.com/Azure/terraform-azurerm-vnet/pull/74) ([lonegunmanb](https://github.com/lonegunmanb))
- Fix default subnet prefixes [\#73](https://github.com/Azure/terraform-azurerm-vnet/pull/73) ([lonegunmanb](https://github.com/lonegunmanb))
- Remove datasource `azurerm_resource_group.vnet`. [\#72](https://github.com/Azure/terraform-azurerm-vnet/pull/72) ([lonegunmanb](https://github.com/lonegunmanb))
- Prepare for CI [\#71](https://github.com/Azure/terraform-azurerm-vnet/pull/71) ([lonegunmanb](https://github.com/lonegunmanb))
- add ddos\_protection\_plan configuration to vnet [\#66](https://github.com/Azure/terraform-azurerm-vnet/pull/66) ([jeongkyeong](https://github.com/jeongkyeong))
- Adding Microsoft SECURITY.MD [\#64](https://github.com/Azure/terraform-azurerm-vnet/pull/64) ([microsoft-github-policy-service[bot]](https://github.com/apps/microsoft-github-policy-service))
- fix: correct typo in description of vnet\_subnets output [\#58](https://github.com/Azure/terraform-azurerm-vnet/pull/58) ([mrparkers](https://github.com/mrparkers))
- Added new output "vnet\_subnets\_name\_id" [\#55](https://github.com/Azure/terraform-azurerm-vnet/pull/55) ([vinshetty](https://github.com/vinshetty))
- Add delegation support to subnet [\#48](https://github.com/Azure/terraform-azurerm-vnet/pull/48) ([stanleyz](https://github.com/stanleyz))
- add variable `vnet_location` to customize vnet location [\#45](https://github.com/Azure/terraform-azurerm-vnet/pull/45) ([yupwei68](https://github.com/yupwei68))
- Update README.md [\#42](https://github.com/Azure/terraform-azurerm-vnet/pull/42) ([sionsmith](https://github.com/sionsmith))
- Docker fix [\#39](https://github.com/Azure/terraform-azurerm-vnet/pull/39) ([yupwei68](https://github.com/yupwei68))
- Integration of Terramodtest 0.8.0 [\#38](https://github.com/Azure/terraform-azurerm-vnet/pull/38) ([yupwei68](https://github.com/yupwei68))
- Create pull\_request\_template.md [\#37](https://github.com/Azure/terraform-azurerm-vnet/pull/37) ([yupwei68](https://github.com/yupwei68))
- Add local variables to prevent unnecessary force replacement and update ReadMe [\#36](https://github.com/Azure/terraform-azurerm-vnet/pull/36) ([yupwei68](https://github.com/yupwei68))
- Update README.md [\#35](https://github.com/Azure/terraform-azurerm-vnet/pull/35) ([stephaneclavel](https://github.com/stephaneclavel))
- Update README.md [\#34](https://github.com/Azure/terraform-azurerm-vnet/pull/34) ([allengeer](https://github.com/allengeer))
- Terraform 0.13 support [\#30](https://github.com/Azure/terraform-azurerm-vnet/pull/30) ([yupwei68](https://github.com/yupwei68))
- Update deprecated field `address_prefix` [\#29](https://github.com/Azure/terraform-azurerm-vnet/pull/29) ([yupwei68](https://github.com/yupwei68))
- Remove resources reference quotes [\#26](https://github.com/Azure/terraform-azurerm-vnet/pull/26) ([bamaralf](https://github.com/bamaralf))
- Support Azurerm 2.0 and removal of resource group [\#24](https://github.com/Azure/terraform-azurerm-vnet/pull/24) ([yupwei68](https://github.com/yupwei68))
- Add Terratest [\#14](https://github.com/Azure/terraform-azurerm-vnet/pull/14) ([foreverXZC](https://github.com/foreverXZC))
- Add route tables to subnets [\#7](https://github.com/Azure/terraform-azurerm-vnet/pull/7) ([jmapro](https://github.com/jmapro))
- Adding support for associating a subnet and network security group [\#6](https://github.com/Azure/terraform-azurerm-vnet/pull/6) ([rguthriemsft](https://github.com/rguthriemsft))
- Updated the name to vnet in Readme [\#5](https://github.com/Azure/terraform-azurerm-vnet/pull/5) ([VaijanathB](https://github.com/VaijanathB))
- updating travls to correct script [\#4](https://github.com/Azure/terraform-azurerm-vnet/pull/4) ([rguthriemsft](https://github.com/rguthriemsft))
- Updating travis and dockerfile [\#3](https://github.com/Azure/terraform-azurerm-vnet/pull/3) ([rguthriemsft](https://github.com/rguthriemsft))
- Fixing test to use local files [\#2](https://github.com/Azure/terraform-azurerm-vnet/pull/2) ([rguthriemsft](https://github.com/rguthriemsft))
- Update README.md [\#1](https://github.com/Azure/terraform-azurerm-vnet/pull/1) ([rguthriemsft](https://github.com/rguthriemsft))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
62 changes: 0 additions & 62 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,62 +0,0 @@
# Changelog

## [3.2.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.2.0) (2022-12-08)

**Merged pull requests:**

- Add new variable `use_for_each` so we can use `for_each` to create multiple resource instances. [\#92](https://github.com/Azure/terraform-azurerm-vnet/pull/92) ([lonegunmanb](https://github.com/lonegunmanb))

## [3.1.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.1.0) (2022-12-07)

**Merged pull requests:**

- Bump tflint plugin version, add new rule [\#91](https://github.com/Azure/terraform-azurerm-vnet/pull/91) ([lonegunmanb](https://github.com/lonegunmanb))
- Ci updating breaking-change-detect [\#90](https://github.com/Azure/terraform-azurerm-vnet/pull/90) ([Pumpkin-3906](https://github.com/Pumpkin-3906))
- Upgrade `terraform-module-test-helper` lib so we can get rid of override file to execute version upgrade test [\#89](https://github.com/Azure/terraform-azurerm-vnet/pull/89) ([lonegunmanb](https://github.com/lonegunmanb))
- Add support for `bgp_community` [\#88](https://github.com/Azure/terraform-azurerm-vnet/pull/88) ([lonegunmanb](https://github.com/lonegunmanb))
- update outputs.tf to bracket syntax [\#86](https://github.com/Azure/terraform-azurerm-vnet/pull/86) ([Pumpkin-3906](https://github.com/Pumpkin-3906))
- Add update changelog step in CI pipeline, update pull request template [\#82](https://github.com/Azure/terraform-azurerm-vnet/pull/82) ([lonegunmanb](https://github.com/lonegunmanb))
- Bump test helper version [\#79](https://github.com/Azure/terraform-azurerm-vnet/pull/79) ([lonegunmanb](https://github.com/lonegunmanb))

## [3.0.0](https://github.com/Azure/terraform-azurerm-vnet/tree/3.0.0) (2022-10-18)

**Implemented enhancements:**

- Allow configure enforce\_private\_link\_endpoint\_network\_policies and enforce\_private\_link\_service\_network\_policies params for subnets [\#40](https://github.com/Azure/terraform-azurerm-vnet/pull/40) ([mathsnunes](https://github.com/mathsnunes))

**Merged pull requests:**

- Add a CI step to detect potential breaking changes. [\#75](https://github.com/Azure/terraform-azurerm-vnet/pull/75) ([lonegunmanb](https://github.com/lonegunmanb))
- Limit `azurerm`'s version to `>= 3.11, < 4.0` [\#74](https://github.com/Azure/terraform-azurerm-vnet/pull/74) ([lonegunmanb](https://github.com/lonegunmanb))
- Fix default subnet prefixes [\#73](https://github.com/Azure/terraform-azurerm-vnet/pull/73) ([lonegunmanb](https://github.com/lonegunmanb))
- Remove datasource `azurerm_resource_group.vnet`. [\#72](https://github.com/Azure/terraform-azurerm-vnet/pull/72) ([lonegunmanb](https://github.com/lonegunmanb))
- Prepare for CI [\#71](https://github.com/Azure/terraform-azurerm-vnet/pull/71) ([lonegunmanb](https://github.com/lonegunmanb))
- add ddos\_protection\_plan configuration to vnet [\#66](https://github.com/Azure/terraform-azurerm-vnet/pull/66) ([jeongkyeong](https://github.com/jeongkyeong))
- Adding Microsoft SECURITY.MD [\#64](https://github.com/Azure/terraform-azurerm-vnet/pull/64) ([microsoft-github-policy-service[bot]](https://github.com/apps/microsoft-github-policy-service))
- fix: correct typo in description of vnet\_subnets output [\#58](https://github.com/Azure/terraform-azurerm-vnet/pull/58) ([mrparkers](https://github.com/mrparkers))
- Added new output "vnet\_subnets\_name\_id" [\#55](https://github.com/Azure/terraform-azurerm-vnet/pull/55) ([vinshetty](https://github.com/vinshetty))
- Add delegation support to subnet [\#48](https://github.com/Azure/terraform-azurerm-vnet/pull/48) ([stanleyz](https://github.com/stanleyz))
- add variable `vnet_location` to customize vnet location [\#45](https://github.com/Azure/terraform-azurerm-vnet/pull/45) ([yupwei68](https://github.com/yupwei68))
- Update README.md [\#42](https://github.com/Azure/terraform-azurerm-vnet/pull/42) ([sionsmith](https://github.com/sionsmith))
- Docker fix [\#39](https://github.com/Azure/terraform-azurerm-vnet/pull/39) ([yupwei68](https://github.com/yupwei68))
- Integration of Terramodtest 0.8.0 [\#38](https://github.com/Azure/terraform-azurerm-vnet/pull/38) ([yupwei68](https://github.com/yupwei68))
- Create pull\_request\_template.md [\#37](https://github.com/Azure/terraform-azurerm-vnet/pull/37) ([yupwei68](https://github.com/yupwei68))
- Add local variables to prevent unnecessary force replacement and update ReadMe [\#36](https://github.com/Azure/terraform-azurerm-vnet/pull/36) ([yupwei68](https://github.com/yupwei68))
- Update README.md [\#35](https://github.com/Azure/terraform-azurerm-vnet/pull/35) ([stephaneclavel](https://github.com/stephaneclavel))
- Update README.md [\#34](https://github.com/Azure/terraform-azurerm-vnet/pull/34) ([allengeer](https://github.com/allengeer))
- Terraform 0.13 support [\#30](https://github.com/Azure/terraform-azurerm-vnet/pull/30) ([yupwei68](https://github.com/yupwei68))
- Update deprecated field `address_prefix` [\#29](https://github.com/Azure/terraform-azurerm-vnet/pull/29) ([yupwei68](https://github.com/yupwei68))
- Remove resources reference quotes [\#26](https://github.com/Azure/terraform-azurerm-vnet/pull/26) ([bamaralf](https://github.com/bamaralf))
- Support Azurerm 2.0 and removal of resource group [\#24](https://github.com/Azure/terraform-azurerm-vnet/pull/24) ([yupwei68](https://github.com/yupwei68))
- Add Terratest [\#14](https://github.com/Azure/terraform-azurerm-vnet/pull/14) ([foreverXZC](https://github.com/foreverXZC))
- Add route tables to subnets [\#7](https://github.com/Azure/terraform-azurerm-vnet/pull/7) ([jmapro](https://github.com/jmapro))
- Adding support for associating a subnet and network security group [\#6](https://github.com/Azure/terraform-azurerm-vnet/pull/6) ([rguthriemsft](https://github.com/rguthriemsft))
- Updated the name to vnet in Readme [\#5](https://github.com/Azure/terraform-azurerm-vnet/pull/5) ([VaijanathB](https://github.com/VaijanathB))
- updating travls to correct script [\#4](https://github.com/Azure/terraform-azurerm-vnet/pull/4) ([rguthriemsft](https://github.com/rguthriemsft))
- Updating travis and dockerfile [\#3](https://github.com/Azure/terraform-azurerm-vnet/pull/3) ([rguthriemsft](https://github.com/rguthriemsft))
- Fixing test to use local files [\#2](https://github.com/Azure/terraform-azurerm-vnet/pull/2) ([rguthriemsft](https://github.com/rguthriemsft))
- Update README.md [\#1](https://github.com/Azure/terraform-azurerm-vnet/pull/1) ([rguthriemsft](https://github.com/rguthriemsft))



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ This module contains resources with `count` meta-argument, but if we change `cou

This module replicated a new `azurerm_subnet` which used `for_each`, and we provide a new toggle variable named `use_for_each`, this toggle is a switcher between `count` set and `for_each` set. Now user can set `var.use_for_each` to `true` to use `for_each`, and users who're maintaining existing resources could keep this toggle `false` to avoid potential breaking change. If you'd like to make changes to subnet resource, make sure that you've change both `resource` blocks. Thanks for your cooperation.

## Notice on Upgrade to V4.x

In v4.0.0, we would make `var.use_for_each` a required variable so the users must set the value explicitly. For whom are maintaining the existing infrastructure that was created with `count` should use `false`, for those who are creating a new stack, we encourage them to use `true`.

V4.0.0 is a major version upgrade. Extreme caution must be taken during the upgrade to avoid resource replacement and downtime by accident.

Running the `terraform plan` first to inspect the plan is strongly advised.

## Notice on Upgrade to V3.x

We've added a CI pipeline for this module to speed up our code review and to enforce a high code quality standard, if you want to contribute by submitting a pull request, please read [Pre-Commit & Pr-Check & Test](#Pre-Commit--Pr-Check--Test) section, or your pull request might be rejected by CI pipeline.
Expand Down Expand Up @@ -169,7 +177,7 @@ No modules.
| <a name="input_subnet_prefixes"></a> [subnet\_prefixes](#input\_subnet\_prefixes) | The address prefix to use for the subnet. | `list(string)` | <pre>[<br> "10.0.1.0/24",<br> "10.0.2.0/24",<br> "10.0.3.0/24"<br>]</pre> | no |
| <a name="input_subnet_service_endpoints"></a> [subnet\_service\_endpoints](#input\_subnet\_service\_endpoints) | A map of subnet name to service endpoints to add to the subnet. | `map(any)` | `{}` | no |
| <a name="input_tags"></a> [tags](#input\_tags) | The tags to associate with your network and subnets. | `map(string)` | <pre>{<br> "ENV": "test"<br>}</pre> | no |
| <a name="input_use_for_each"></a> [use\_for\_each](#input\_use\_for\_each) | Use `for_each` instead of `count` to create multiple resource instances. | `bool` | `false` | no |
| <a name="input_use_for_each"></a> [use\_for\_each](#input\_use\_for\_each) | Use `for_each` instead of `count` to create multiple resource instances. | `bool` | n/a | yes |
| <a name="input_vnet_location"></a> [vnet\_location](#input\_vnet\_location) | The location of the vnet to create. | `string` | n/a | yes |
| <a name="input_vnet_name"></a> [vnet\_name](#input\_vnet\_name) | Name of the vnet to create | `string` | `"acctvnet"` | no |

Expand Down
13 changes: 6 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ variable "resource_group_name" {
nullable = false
}

variable "use_for_each" {
description = "Use `for_each` instead of `count` to create multiple resource instances."
type = bool
nullable = false
}

variable "vnet_location" {
description = "The location of the vnet to create."
type = string
Expand Down Expand Up @@ -97,13 +103,6 @@ variable "tags" {
}
}

variable "use_for_each" {
description = "Use `for_each` instead of `count` to create multiple resource instances."
type = bool
default = false
nullable = false
}

variable "vnet_name" {
description = "Name of the vnet to create"
type = string
Expand Down

0 comments on commit 692af67

Please sign in to comment.