generated from aws-ia/terraform-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from pablo19sc/main
Adding aws_networkmanager_core_network_policy_attachment resource and base_policy attribute
- Loading branch information
Showing
24 changed files
with
326 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Changes from 0.x to 1.x | ||
|
||
If you are using a version 0.x of this module and want to move to a version 1.x, you will find that we have migrated from using the [AWSCC](https://registry.terraform.io/providers/hashicorp/awscc/latest) provider to [AWS](https://registry.terraform.io/providers/hashicorp/aws/latest/docs) provider for the Global and Core Network resources. If you want to udpate the version without re-creating the resources, you need to proceed as follows: | ||
|
||
* First, add in your main.tf (or similar file) a new module definition. In this new definition you need to pass the current Global Network without creating a new one. | ||
|
||
```hcl | ||
module "cloudwan" { | ||
source = "aws-ia/cloudwan/aws" | ||
version = "0.x.x" | ||
global_network = { | ||
create = true | ||
description = "Global Network - AWS CloudWAN Module" | ||
} | ||
core_network = { | ||
description = "Core Network - AWS CloudWAN Module" | ||
policy_document = data.aws_networkmanager_core_network_policy_document.main.json | ||
} | ||
tags = { | ||
Name = "create-global-network" | ||
} | ||
} | ||
module "new_cloudwan" { | ||
source = "aws-ia/cloudwan/aws" | ||
version = "1.x.x" | ||
global_network = { | ||
create = false | ||
id = "global-network-XXX" | ||
} | ||
core_network = { | ||
description = "Core Network - AWS CloudWAN Module" | ||
policy_document = data.aws_networkmanager_core_network_policy_document.main.json | ||
} | ||
tags = { | ||
Name = "create-global-network" | ||
} | ||
} | ||
``` | ||
|
||
* Next, do a Terraform import for the new Global and Core Network resources. | ||
|
||
``` | ||
terraform import module.new_cloudwan.aws_networkmanager_global_network.global_network[0] global-network-XXX | ||
terraform import module.new_cloudwan.aws_networkmanager_core_network.core_network core-network-XXX | ||
``` | ||
|
||
* Now you can remove from the Terraform state the old resources | ||
|
||
``` | ||
terraform state rm module.cloudwan.awscc_networkmanager_global_network.global_network[0] | ||
terraform state rm module.new_cloudwan.awscc_networkmanager_core_network.core_network | ||
``` | ||
|
||
* Finally, you can remove the definition of the old module (the one using version 0.x) from your main.tf file (or similar) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Changes from 1.x to 2.x | ||
|
||
Changes from version 1 to version 2 of this module are minimal, and **don't entail any downtime**. However, check this guide to understand the new behavior. | ||
|
||
There's a new resource added - `aws_networkmanager_core_network_policy_attachment`- that doesn't create new resources, rather it decouples the creation of the Core Network to the policy document attachment. This is used to avoid circular dependencies when you reference Core Network attachment IDs in the policy document. | ||
|
||
So, if you move from version 1.x.x to 2.x.x and you do a `terraform plan`, you will see 1 new resource to be created. When doing a `terraform apply`, it will generate a new policy version in the Core Network containing the same policy you currently have (unless you apply changes). You won't have any disruption. | ||
|
||
If you want to avoid the creation of this resource and the generation of the new policy version, you can import the resource by doing: | ||
|
||
``` | ||
terraform import module.cloudwan.aws_networkmanager_core_network_policy_attachment.policy_attachment core-network-XXX | ||
``` | ||
|
||
If you do a `terraform plan`, you won't see any changes in the infrastructure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# AWS Cloud WAN Module - Example with base_policy | ||
|
||
This example creates a Network Manager Global Network and Cloud WAN Core Network from scratch, using the base_policy attribute. | ||
|
||
## Usage | ||
|
||
- Initialize Terraform using `terraform init`. | ||
- Now you can deploy the rest of the infrastructure using `terraform apply`. | ||
- To delete everything, use `terraform destroy`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
formatter: markdown | ||
header-from: .header.md | ||
settings: | ||
anchor: true | ||
color: true | ||
default: true | ||
escape: true | ||
html: true | ||
indent: 2 | ||
required: true | ||
sensitive: true | ||
type: true | ||
|
||
sort: | ||
enabled: true | ||
by: required | ||
|
||
output: | ||
file: README.md | ||
mode: replace |
Oops, something went wrong.