|
| 1 | +## Purpose |
| 2 | + |
| 3 | +This module is considered to be a [data-only](https://www.terraform.io/docs/language/modules/develop/composition.html#data-only-modules) module. Given the name of a VPC and an optional set of availability zones, this module returns information about a VPC, such as public and private subnets, the VPC ID, etc. See the [outputs](outputs.tf) file for which data is returned from this module. This module is useful for workspaces that require such information without declaring repetitive `data` sources in your Terraform configurations. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +The following example creates a security group and an application load balancer. |
| 8 | + |
| 9 | +```hcl |
| 10 | +provider "aws" {} |
| 11 | +
|
| 12 | +module "networking" { |
| 13 | + source = "api.env0.com/0d3fca0b-57fe-4d36-9132-cf4949639403/networking-readonly/aws" |
| 14 | + version = "v1.0.0" |
| 15 | +
|
| 16 | + vpc_name = "tutorial-vpc" |
| 17 | +} |
| 18 | +
|
| 19 | +resource "aws_security_group" "this" { |
| 20 | + ingress = [ |
| 21 | + { |
| 22 | + cidr_blocks = ["0.0.0.0/0"] |
| 23 | + from_port = 443 |
| 24 | + protocol = "TCP" |
| 25 | + to_port = 443 |
| 26 | + } |
| 27 | + ] |
| 28 | +
|
| 29 | + vpc_id = module.networking.vpc_id |
| 30 | +} |
| 31 | +
|
| 32 | +resource "aws_lb" "this" { |
| 33 | + internal = false |
| 34 | + load_balancer_type = "application" |
| 35 | + security_groups = [aws_security_group.this.id] |
| 36 | + subnets = module.networking.public_subnets |
| 37 | +} |
| 38 | +``` |
| 39 | + |
1 | 40 | <!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
| 41 | + |
2 | 42 | ## Requirements
|
3 | 43 |
|
4 |
| -| Name | Version | |
5 |
| -|------|---------| |
6 |
| -| aws | ~> 3.64.2 | |
| 44 | +| Name | Version | |
| 45 | +| ---- | --------- | |
| 46 | +| aws | ~> 3.64.2 | |
7 | 47 |
|
8 | 48 | ## Providers
|
9 | 49 |
|
10 |
| -| Name | Version | |
11 |
| -|------|---------| |
12 |
| -| aws | ~> 3.64.2 | |
| 50 | +| Name | Version | |
| 51 | +| ---- | --------- | |
| 52 | +| aws | ~> 3.64.2 | |
13 | 53 |
|
14 | 54 | ## Inputs
|
15 | 55 |
|
16 |
| -| Name | Description | Type | Default | Required | |
17 |
| -|------|-------------|------|---------|:--------:| |
18 |
| -| availability\_zones | Select subnets only in the given AZs | `set(string)` | `[]` | no | |
19 |
| -| vpc\_name | The name of the VPC | `string` | n/a | yes | |
| 56 | +| Name | Description | Type | Default | Required | |
| 57 | +| ------------------ | ------------------------------------ | ------------- | ------- | :------: | |
| 58 | +| availability_zones | Select subnets only in the given AZs | `set(string)` | `[]` | no | |
| 59 | +| vpc_name | The name of the VPC | `string` | n/a | yes | |
20 | 60 |
|
21 | 61 | ## Outputs
|
22 | 62 |
|
23 |
| -| Name | Description | |
24 |
| -|------|-------------| |
25 |
| -| dns\_hostnames\_enabled | Indicates if instances launched in this VPC will have public DNS hostnames | |
26 |
| -| dns\_support\_enabled | Indicates if DNS support is enabled for this VPC | |
27 |
| -| private\_subnets | List of private subnets in this VPC | |
28 |
| -| public\_subnets | List of public subnets in this VPC | |
29 |
| -| vpc\_arn | Arn of this VPC | |
30 |
| -| vpc\_cidr\_block | CIDR range for this VPC | |
31 |
| -| vpc\_id | The ID of the VPC | |
| 63 | +| Name | Description | |
| 64 | +| --------------------- | -------------------------------------------------------------------------- | |
| 65 | +| dns_hostnames_enabled | Indicates if instances launched in this VPC will have public DNS hostnames | |
| 66 | +| dns_support_enabled | Indicates if DNS support is enabled for this VPC | |
| 67 | +| private_subnets | List of private subnets in this VPC | |
| 68 | +| public_subnets | List of public subnets in this VPC | |
| 69 | +| vpc_arn | Arn of this VPC | |
| 70 | +| vpc_cidr_block | CIDR range for this VPC | |
| 71 | +| vpc_id | The ID of the VPC | |
32 | 72 |
|
33 | 73 | <!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
|
| 74 | + |
| 75 | +## License |
| 76 | + |
| 77 | +[MIT License](LICENSE) |
0 commit comments