You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .header.md
+33-3Lines changed: 33 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,16 @@
1
1
# Terraform Module for Amazon VPC IP Address Manager on AWS
2
2
3
-
Built to accommodate a wide range of use cases, this Terraform module can deploy both simple and complex Amazon Virtual Private Cloud (Amazon VPC) IP Address Manager (IPAM) configurations. It supports both symmetrically nested, multi-Region deployments (most common IPAM designs) as well as [asymmetically nested deployments](images/asymmetrical_example.png).
3
+
Built to accommodate a wide range of use cases, this Terraform module can deploy both simple and complex Amazon Virtual Private Cloud (Amazon VPC) IP Address Manager (IPAM) configurations. It supports both symmetrically nested, multi-Region deployments (most common IPAM designs) as well as [asymmetically nested deployments](https://github.com/aws-ia/terraform-aws-ipam/blob/main/images/asymmetrical_example.png).
4
4
5
-
Refer to the [examples/](./examples/) directory in this GitHub repository for examples.
5
+
Refer to the [examples/](https://github.com/aws-ia/terraform-aws-ipam/blob/main/examples) directory in this GitHub repository for examples.
6
6
7
7
The embedded example below describes a symmetrically nested pool structure, including its configuration, implementation details, requirements, and more.
8
8
9
9
## Architecture
10
10
11
-

11
+
<palign="center">
12
+
<imgsrc="https://raw.githubusercontent.com/aws-ia/terraform-aws-ipam/main/images/ipam_symmetrical.png"alt="symmetrically nested pool deployment"width="100%">
13
+
</p>
12
14
13
15
## Configuration
14
16
This module strongly relies on the `var.pool_configuration` variable, which is a multi-level, nested map that describes how to nest your IPAM pools. It can accept most `aws_vpc_ipam_pool` and `aws_vpc_ipam_pool_cidr` attributes (detailed below) as well as RAM share pools (at any level) to valid AWS principals. Nested pools do not inherit attributes from their source pool(s), so all configuration options are available at each level. `locale` is implied in sub pools after declared in a parent.
@@ -63,6 +65,34 @@ variable "pool_config" {
63
65
}
64
66
```
65
67
68
+
## RAM Sharing
69
+
70
+
This module allows you to share invidual pools to any valid RAM principal. All levels of `var.pool_configurations` accept an argument `ram_share_principals` which should be a list of valid RAM share principals (org-id, ou-id, or account id).
71
+
72
+
## Using Outputs
73
+
74
+
Since resources are dynamically generated based on user configuration, we roll them into grouped outputs. For example, to get attributes off your level 2 pools:
75
+
76
+
The output `pools_level_2` offers you a map of every pool where the name is the route of the tree keys [example `"corporate-us-west-2/dev"`](https://github.com/aws-ia/terraform-aws-ipam/blob/a7d508cb0be2f68d99952682c2392b6d7d541d96/examples/single_scope_ipv4/main.tf#L28).
Copy file name to clipboardExpand all lines: README.md
+36-6Lines changed: 36 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,17 @@
1
1
<!-- BEGIN_TF_DOCS -->
2
2
# Terraform Module for Amazon VPC IP Address Manager on AWS
3
3
4
-
Built to accommodate a wide range of use cases, this Terraform module can deploy both simple and complex Amazon Virtual Private Cloud (Amazon VPC) IP Address Manager (IPAM) configurations. It supports both symmetrically nested, multi-Region deployments (most common IPAM designs) as well as [asymmetically nested deployments](images/asymmetrical\_example.png).
4
+
Built to accommodate a wide range of use cases, this Terraform module can deploy both simple and complex Amazon Virtual Private Cloud (Amazon VPC) IP Address Manager (IPAM) configurations. It supports both symmetrically nested, multi-Region deployments (most common IPAM designs) as well as [asymmetically nested deployments](https://github.com/aws-ia/terraform-aws-ipam/blob/main/images/asymmetrical_example.png).
5
5
6
-
Refer to the [examples/](./examples/) directory in this GitHub repository for examples.
6
+
Refer to the [examples/](https://github.com/aws-ia/terraform-aws-ipam/blob/main/examples) directory in this GitHub repository for examples.
7
7
8
8
The embedded example below describes a symmetrically nested pool structure, including its configuration, implementation details, requirements, and more.
9
9
10
10
## Architecture
11
11
12
-

12
+
<palign="center">
13
+
<imgsrc="https://raw.githubusercontent.com/aws-ia/terraform-aws-ipam/main/images/ipam_symmetrical.png"alt="symmetrically nested pool deployment"width="100%">
14
+
</p>
13
15
14
16
## Configuration
15
17
This module strongly relies on the `var.pool_configuration` variable, which is a multi-level, nested map that describes how to nest your IPAM pools. It can accept most `aws_vpc_ipam_pool` and `aws_vpc_ipam_pool_cidr` attributes (detailed below) as well as RAM share pools (at any level) to valid AWS principals. Nested pools do not inherit attributes from their source pool(s), so all configuration options are available at each level. `locale` is implied in sub pools after declared in a parent.
@@ -64,6 +66,34 @@ variable "pool_config" {
64
66
}
65
67
```
66
68
69
+
## RAM Sharing
70
+
71
+
This module allows you to share invidual pools to any valid RAM principal. All levels of `var.pool_configurations` accept an argument `ram_share_principals` which should be a list of valid RAM share principals (org-id, ou-id, or account id).
72
+
73
+
## Using Outputs
74
+
75
+
Since resources are dynamically generated based on user configuration, we roll them into grouped outputs. For example, to get attributes off your level 2 pools:
76
+
77
+
The output `pools_level_2` offers you a map of every pool where the name is the route of the tree keys [example `"corporate-us-west-2/dev"`](https://github.com/aws-ia/terraform-aws-ipam/blob/a7d508cb0be2f68d99952682c2392b6d7d541d96/examples/single_scope_ipv4/main.tf#L28).
@@ -116,12 +146,12 @@ The IPAM `operating_region` variable must be set for the primary Region in your
116
146
| <aname="input_create_ipam"></a> [create\_ipam](#input\_create\_ipam)| Determines whether to create an IPAM. If `false`, you must also provide a var.ipam\_scope\_id. |`bool`|`true`| no |
117
147
| <aname="input_ipam_scope_id"></a> [ipam\_scope\_id](#input\_ipam\_scope\_id)| (Optional) Required if `var.ipam_id` is set. Determines which scope to deploy pools into. |`string`|`null`| no |
118
148
| <aname="input_ipam_scope_type"></a> [ipam\_scope\_type](#input\_ipam\_scope\_type)| Which scope type to use. Valid inputs include `public` or `private`. You can alternatively provide your own scope ID. |`string`|`"private"`| no |
119
-
| <aname="input_pool_configurations"></a> [pool\_configurations](#input\_pool\_configurations)| A multi-level, nested map describing nested IPAM pools. Can nest up to three levels with the top level being outside the `pool_configurations`. This attribute is quite complex, see README.md for further explanation. |`any`|`{}`| no |
149
+
| <a name="input_pool_configurations"></a> [pool\_configurations](#input\_pool\_configurations) | A multi-level, nested map describing nested IPAM pools. Can nest up to three levels with the top level being outside the `pool_configurations` in vars prefixed `top_`. If arugument descriptions are omitted, you can find them in the [official documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool#argument-reference).<br><br>- `ram_share_principals` = (optional, list(string)) of valid organization principals to create ram shares to.<br>- `name` = (optional, string) name to give the pool, the key of your map in var.pool\_configurations will be used if omitted.<br>- `description` = (optional, string) description to give the pool, the key of your map in var.pool\_configurations will be used if omitted.<br>- `cidr` = (optional, list(string)) list of CIDRs to provision into pool.<br><br>- `locale` = (optional, string) locale to set for pool.<br>- `auto_import` = (optional, string)<br>- `tags` = (optional, map(string))<br>- `allocation_default_netmask_length` = (optional, string)<br>- `allocation_max_netmask_length` = (optional, string)<br>- `allocation_min_netmask_length` = (optional, string)<br>- `allocation_resource_tags` = (optional, map(string))<br><br>The following arguments are available but only relevant for public ips<br>- `cidr_authorization_context` = (optional, map(string)) Details found in [official documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr#cidr_authorization_context).<br>- `aws_service` = (optional, string)<br>- `publicly_advertisable` = (optional, bool)<br><br>- `sub_pools` = (nested repeats of pool\_configuration object above) | `any` | `{}` | no |
120
150
| <aname="input_tags"></a> [tags](#input\_tags)| Tags to add to the aws\_vpc\_ipam resource. |`any`|`{}`| no |
121
151
| <aname="input_top_auto_import"></a> [top\_auto\_import](#input\_top\_auto\_import)|`auto_import` setting for top-level pool. |`bool`|`null`| no |
122
152
| <aname="input_top_cidr_authorization_context"></a> [top\_cidr\_authorization\_context](#input\_top\_cidr\_authorization\_context)| A signed document that proves that you are authorized to bring the specified IP address range to Amazon using BYOIP. Document is not stored in the state file. For more information, refer to https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr#cidr_authorization_context.|`any`|`null`| no |
123
153
| <aname="input_top_description"></a> [top\_description](#input\_top\_description)| Description of top-level pool. |`string`|`""`| no |
124
-
| <aname="input_top_name"></a> [top\_name](#input\_top\_name)| Name of top-level pool. |`string`|`""`| no |
154
+
| <aname="input_top_name"></a> [top\_name](#input\_top\_name)| Name of top-level pool. |`string`|`null`| no |
125
155
| <aname="input_top_ram_share_principals"></a> [top\_ram\_share\_principals](#input\_top\_ram\_share\_principals)| Principals to create RAM shares for top-level pool. |`list(string)`|`null`| no |
Copy file name to clipboardExpand all lines: variables.tf
+26-32Lines changed: 26 additions & 32 deletions
Original file line number
Diff line number
Diff line change
@@ -1,35 +1,29 @@
1
1
variable"pool_configurations" {
2
-
description="A multi-level, nested map describing nested IPAM pools. Can nest up to three levels with the top level being outside the `pool_configurations`. This attribute is quite complex, see README.md for further explanation."
3
2
type=any
4
-
5
-
# Below is an example of the actual expected structure for `pool_configurations`. type = any is currently being used, may adjust in the future
# sub_pools = (repeat of pool_configuration object above )
24
-
# })
25
-
default={}
26
-
27
-
# Validate no more than 3 layers of sub_pools specified
28
-
# TODO: fix validation, fails if less than 2 layers of pools
29
-
# validation {
30
-
# error_message = "Sub pools (sub_pools) is defined in the 3rd level of a nested pool. Sub pools can only be defined up to 3 levels."
31
-
# condition = flatten([for k, v in var.pool_configurations : [for k2, v2 in v.sub_pools : [for k3, v3 in try(v2.sub_pools, []) : "${k}/${k2}/${k3}" if try(v3.sub_pools, []) != []]]]) == []
32
-
# }
3
+
default={}
4
+
description=<<-EOF
5
+
A multi-level, nested map describing nested IPAM pools. Can nest up to three levels with the top level being outside the `pool_configurations` in vars prefixed `top_`. If arugument descriptions are omitted, you can find them in the [official documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool#argument-reference).
6
+
7
+
- `ram_share_principals` = (optional, list(string)) of valid organization principals to create ram shares to.
8
+
- `name` = (optional, string) name to give the pool, the key of your map in var.pool_configurations will be used if omitted.
9
+
- `description` = (optional, string) description to give the pool, the key of your map in var.pool_configurations will be used if omitted.
10
+
- `cidr` = (optional, list(string)) list of CIDRs to provision into pool.
11
+
12
+
- `locale` = (optional, string) locale to set for pool.
The following arguments are available but only relevant for public ips
21
+
- `cidr_authorization_context` = (optional, map(string)) Details found in [official documentation](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/vpc_ipam_pool_cidr#cidr_authorization_context).
22
+
- `aws_service` = (optional, string)
23
+
- `publicly_advertisable` = (optional, bool)
24
+
25
+
- `sub_pools` = (nested repeats of pool_configuration object above)
26
+
EOF
33
27
}
34
28
35
29
variable"top_cidr" {
@@ -58,7 +52,7 @@ variable "top_description" {
58
52
variable"top_name" {
59
53
description="Name of top-level pool."
60
54
type=string
61
-
default=""
55
+
default=null
62
56
}
63
57
64
58
variable"top_cidr_authorization_context" {
@@ -104,4 +98,4 @@ variable "tags" {
104
98
description="Tags to add to the aws_vpc_ipam resource."
0 commit comments