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 #2 from pablo19sc/main
CloudWAN Module - v1.0
- Loading branch information
Showing
27 changed files
with
572 additions
and
161 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,45 @@ | ||
# Creating modules for AWS I&A Organization | ||
|
||
This repo template is used to seed Terraform Module templates for the [AWS I&A GitHub organization](https://github.com/aws-ia). Usage of this template is allowed per included license. PRs to this template will be considered but are not guaranteed to be included. Consider creating an issue to discuss a feature you want to include before taking the time to create a PR. | ||
### TL;DR | ||
|
||
1. [install pre-commit](https://pre-commit.com/) | ||
2. configure pre-commit: `pre-commit install` | ||
3. install required tools | ||
- [tflint](https://github.com/terraform-linters/tflint) | ||
- [tfsec](https://aquasecurity.github.io/tfsec/v1.0.11/) | ||
- [terraform-docs](https://github.com/terraform-docs/terraform-docs) | ||
- [golang](https://go.dev/doc/install) (for macos you can use `brew`) | ||
- [coreutils](https://www.gnu.org/software/coreutils/) | ||
|
||
Write code according to [I&A module standards](https://aws-ia.github.io/standards-terraform/) | ||
|
||
## Module Documentation | ||
|
||
**Do not manually update README.md**. `terraform-docs` is used to generate README files. For any instructions an content, please update [.header.md](./.header.md) then simply run `terraform-docs ./` or allow the `pre-commit` to do so. | ||
|
||
## Terratest | ||
|
||
Please include tests to validate your examples/<> root modules, at a minimum. This can be accomplished with usually only slight modifications to the [boilerplate test provided in this template](./test/examples_basic_test.go) | ||
|
||
### Configure and run Terratest | ||
|
||
1. Install | ||
|
||
[golang](https://go.dev/doc/install) (for macos you can use `brew`) | ||
2. Change directory into the test folder. | ||
|
||
`cd test` | ||
3. Initialize your test | ||
|
||
go mod init github.com/[github org]/[repository] | ||
|
||
`go mod init github.com/aws-ia/terraform-aws-vpc` | ||
4. Run tidy | ||
|
||
`git mod tidy` | ||
5. Install Terratest | ||
|
||
`go get github.com/gruntwork-io/terratest/modules/terraform` | ||
6. Run test (You can have multiple test files). | ||
- Run all tests | ||
|
||
`go test` | ||
- Run a specific test with a timeout | ||
|
||
`go test -run examples_basic_test.go -timeout 45m` | ||
## Module Standards | ||
|
||
For best practices and information on developing with Terraform, see the [I&A Module Standards](https://aws-ia.github.io/standards-terraform/) | ||
|
||
## Continuous Integration | ||
|
||
The I&A team uses AWS CodeBuild to perform continuous integration (CI) within the organization. Our CI uses the a repo's `.pre-commit-config.yaml` file as well as some other checks. All PRs with other CI will be rejected. See our [FAQ](https://aws-ia.github.io/standards-terraform/faq/#are-modules-protected-by-ci-automation) for more details. | ||
# AWS Cloud WAN Module | ||
|
||
This module can be used to deploy an [AWS Cloud WAN](https://docs.aws.amazon.com/vpc/latest/cloudwan/what-is-cloudwan.html) Core Network using the [Terraform AWS Cloud Control Provider](https://github.com/hashicorp/terraform-provider-awscc). A Core Network is built inside a Global Network, so if that resources is not provided, it is also created. | ||
|
||
## Usage | ||
|
||
The example below builds a Network Manager Global Network and a Cloud WAN Core Network from scratch. The Core Network needs the ID of the Global Network created, and also a policy document (to define the global infrastructure). An example of a policy document can be found [here](./examples/without_globalnetwork/locals.tf). | ||
|
||
```hcl | ||
module "cloudwan" { | ||
source = "../.." | ||
global_network = { | ||
description = "Global Network - AWS CloudWAN Module" | ||
} | ||
core_network = { | ||
description = "Core Network - AWS CloudWAN Module" | ||
policy_document = local.policy | ||
} | ||
tags = { | ||
Name = "cloudwan-module-without" | ||
} | ||
} | ||
``` | ||
|
||
If you already have a Network Manager Global Network created, you can pass the ID as variable and only create the Cloud Wan Core Network. | ||
|
||
```hcl | ||
module "cloudwan" { | ||
source = "../.." | ||
global_network = { | ||
id = aws_networkmanager_global_network.global_network.id | ||
} | ||
core_network = { | ||
description = "Global Network - AWS CloudWAN Module" | ||
policy_document = local.policy | ||
} | ||
tags = { | ||
Name = "cloudwan-module-with" | ||
} | ||
} | ||
``` |
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 |
---|---|---|
@@ -1,87 +1,88 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
# Creating modules for AWS I&A Organization | ||
# AWS Cloud WAN Module | ||
|
||
This repo template is used to seed Terraform Module templates for the [AWS I&A GitHub organization](https://github.com/aws-ia). Usage of this template is allowed per included license. PRs to this template will be considered but are not guaranteed to be included. Consider creating an issue to discuss a feature you want to include before taking the time to create a PR. | ||
### TL;DR | ||
This module can be used to deploy an [AWS Cloud WAN](https://docs.aws.amazon.com/vpc/latest/cloudwan/what-is-cloudwan.html) Core Network using the [Terraform AWS Cloud Control Provider](https://github.com/hashicorp/terraform-provider-awscc). A Core Network is built inside a Global Network, so if that resources is not provided, it is also created. | ||
|
||
1. [install pre-commit](https://pre-commit.com/) | ||
2. configure pre-commit: `pre-commit install` | ||
3. install required tools | ||
- [tflint](https://github.com/terraform-linters/tflint) | ||
- [tfsec](https://aquasecurity.github.io/tfsec/v1.0.11/) | ||
- [terraform-docs](https://github.com/terraform-docs/terraform-docs) | ||
- [golang](https://go.dev/doc/install) (for macos you can use `brew`) | ||
- [coreutils](https://www.gnu.org/software/coreutils/) | ||
## Usage | ||
|
||
Write code according to [I&A module standards](https://aws-ia.github.io/standards-terraform/) | ||
The example below builds a Network Manager Global Network and a Cloud WAN Core Network from scratch. The Core Network needs the ID of the Global Network created, and also a policy document (to define the global infrastructure). An example of a policy document can be found [here](./examples/without\_globalnetwork/locals.tf). | ||
|
||
## Module Documentation | ||
```hcl | ||
module "cloudwan" { | ||
source = "../.." | ||
**Do not manually update README.md**. `terraform-docs` is used to generate README files. For any instructions an content, please update [.header.md](./.header.md) then simply run `terraform-docs ./` or allow the `pre-commit` to do so. | ||
global_network = { | ||
description = "Global Network - AWS CloudWAN Module" | ||
} | ||
core_network = { | ||
description = "Core Network - AWS CloudWAN Module" | ||
policy_document = local.policy | ||
} | ||
## Terratest | ||
tags = { | ||
Name = "cloudwan-module-without" | ||
} | ||
} | ||
``` | ||
|
||
Please include tests to validate your examples/<> root modules, at a minimum. This can be accomplished with usually only slight modifications to the [boilerplate test provided in this template](./test/examples\_basic\_test.go) | ||
If you already have a Network Manager Global Network created, you can pass the ID as variable and only create the Cloud Wan Core Network. | ||
|
||
### Configure and run Terratest | ||
```hcl | ||
module "cloudwan" { | ||
source = "../.." | ||
1. Install | ||
global_network = { | ||
id = aws_networkmanager_global_network.global_network.id | ||
} | ||
core_network = { | ||
description = "Global Network - AWS CloudWAN Module" | ||
policy_document = local.policy | ||
} | ||
[golang](https://go.dev/doc/install) (for macos you can use `brew`) | ||
2. Change directory into the test folder. | ||
|
||
`cd test` | ||
3. Initialize your test | ||
|
||
go mod init github.com/[github org]/[repository] | ||
|
||
`go mod init github.com/aws-ia/terraform-aws-vpc` | ||
4. Run tidy | ||
|
||
`git mod tidy` | ||
5. Install Terratest | ||
|
||
`go get github.com/gruntwork-io/terratest/modules/terraform` | ||
6. Run test (You can have multiple test files). | ||
- Run all tests | ||
|
||
`go test` | ||
- Run a specific test with a timeout | ||
|
||
`go test -run examples_basic_test.go -timeout 45m` | ||
## Module Standards | ||
|
||
For best practices and information on developing with Terraform, see the [I&A Module Standards](https://aws-ia.github.io/standards-terraform/) | ||
|
||
## Continuous Integration | ||
|
||
The I&A team uses AWS CodeBuild to perform continuous integration (CI) within the organization. Our CI uses the a repo's `.pre-commit-config.yaml` file as well as some other checks. All PRs with other CI will be rejected. See our [FAQ](https://aws-ia.github.io/standards-terraform/faq/#are-modules-protected-by-ci-automation) for more details. | ||
tags = { | ||
Name = "cloudwan-module-with" | ||
} | ||
} | ||
``` | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72.0 | | ||
| <a name="requirement_awscc"></a> [awscc](#requirement\_awscc) | >= 0.11.0 | | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.15.3 | | ||
| <a name="requirement_awscc"></a> [awscc](#requirement\_awscc) | >= 0.21.0 | | ||
|
||
## Providers | ||
|
||
No providers. | ||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_awscc"></a> [awscc](#provider\_awscc) | 0.21.0 | | ||
|
||
## Modules | ||
|
||
No modules. | ||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_tags"></a> [tags](#module\_tags) | aws-ia/label/aws | 0.0.5 | | ||
|
||
## Resources | ||
|
||
No resources. | ||
| Name | Type | | ||
|------|------| | ||
| [awscc_networkmanager_core_network.core_network](https://registry.terraform.io/providers/hashicorp/awscc/latest/docs/resources/networkmanager_core_network) | resource | | ||
| [awscc_networkmanager_global_network.global_network](https://registry.terraform.io/providers/hashicorp/awscc/latest/docs/resources/networkmanager_global_network) | resource | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_core_network"></a> [core\_network](#input\_core\_network) | Core Network information. | <pre>object({<br> description = string<br> policy_document = any<br> })</pre> | n/a | yes | | ||
| <a name="input_global_network"></a> [global\_network](#input\_global\_network) | Global Network - if the ID is not provided, the module creates it. | <pre>object({<br> id = optional(string)<br> description = optional(string)<br> })</pre> | n/a | yes | | ||
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to apply to all resources. | `map(string)` | `{}` | no | | ||
|
||
## Outputs | ||
|
||
No outputs. | ||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_core_network"></a> [core\_network](#output\_core\_network) | Core Network information. | | ||
| <a name="output_global_network"></a> [global\_network](#output\_global\_network) | Global Network information. | | ||
<!-- END_TF_DOCS --> |
This file was deleted.
Oops, something went wrong.
Empty file.
Empty file.
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,10 @@ | ||
# AWS Cloud WAN Module - Example with a Network Manager Global Network created | ||
|
||
This example creates a Cloud WAN Core Network from scratch, using the Terraform AWS Cloud Control Provider. It supposes that a Network Manager Global Network is already created (using the Terraform AWS Provider), so it takes the ID as parameter. | ||
|
||
## Usage | ||
|
||
- Initialize Terraform using `terraform init`. | ||
- As the Global Network should be created beforehand, first you need to deploy that resource first: `terraform apply -target=aws_networkmanager_global_network.global_network` | ||
- 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 |
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,49 @@ | ||
<!-- BEGIN_TF_DOCS --> | ||
# AWS Cloud WAN Module - Example with a Network Manager Global Network created | ||
|
||
This example creates a Cloud WAN Core Network from scratch, using the Terraform AWS Cloud Control Provider. It supposes that a Network Manager Global Network is already created (using the Terraform AWS Provider), so it takes the ID as parameter. | ||
|
||
## Usage | ||
|
||
- Initialize Terraform using `terraform init`. | ||
- As the Global Network should be created beforehand, first you need to deploy that resource first: `terraform apply -target=aws_networkmanager_global_network.global_network` | ||
- Now you can deploy the rest of the infrastructure using `terraform apply`. | ||
- To delete everything, use `terraform destroy`. | ||
|
||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.14.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.72.0 | | ||
| <a name="requirement_awscc"></a> [awscc](#requirement\_awscc) | >= 0.21.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | 4.14.0 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_cloudwan"></a> [cloudwan](#module\_cloudwan) | ../.. | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_networkmanager_global_network.global_network](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/networkmanager_global_network) | resource | | ||
|
||
## Inputs | ||
|
||
No inputs. | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_core_network"></a> [core\_network](#output\_core\_network) | Core Network - created with AWS CloudWAN module. | | ||
| <a name="output_global_network"></a> [global\_network](#output\_global\_network) | Global Network - created with AWS provider. | | ||
<!-- END_TF_DOCS --> |
Oops, something went wrong.