|
1 | 1 | provider "aws" { |
| 2 | + region = local.region |
| 3 | +} |
| 4 | + |
| 5 | +data "aws_availability_zones" "available" {} |
| 6 | + |
| 7 | +locals { |
| 8 | + name = "ex-${basename(path.cwd)}" |
2 | 9 | region = "us-east-1" |
| 10 | + azs = slice(data.aws_availability_zones.available.names, 0, 2) |
| 11 | + |
| 12 | + tags = { |
| 13 | + Example = local.name |
| 14 | + GithubRepo = "terraform-aws-vpc" |
| 15 | + GithubOrg = "terraform-aws-modules" |
| 16 | + } |
3 | 17 | } |
4 | 18 |
|
| 19 | +################################################################################ |
| 20 | +# EC2 Instance Connect Endpoint Example |
| 21 | +################################################################################ |
| 22 | + |
5 | 23 | module "vpc" { |
6 | 24 | source = "../../" |
7 | 25 |
|
8 | | - name = "example-vpc" |
| 26 | + name = local.name |
9 | 27 | cidr = "10.0.0.0/16" |
10 | 28 |
|
11 | | - azs = ["us-east-1a", "us-east-1b"] |
| 29 | + azs = local.azs |
12 | 30 | private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] |
13 | 31 | public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] |
14 | 32 |
|
15 | 33 | enable_nat_gateway = true |
16 | 34 | single_nat_gateway = true |
17 | 35 |
|
18 | | - create_instance_connect_endpoint = true |
19 | | - instance_connect_subnet_id = element(module.vpc.private_subnets, 0) |
20 | | - instance_connect_security_group_ids = [aws_security_group.allow_ssh.id] |
21 | | - instance_connect_preserve_client_ip = false |
| 36 | + create_instance_connect_endpoint = true |
| 37 | + instance_connect_subnet_id = element(local.private_subnets, 0) |
| 38 | + instance_connect_security_group_ids = [aws_security_group.allow_ssh.id] |
| 39 | + instance_connect_preserve_client_ip = false |
| 40 | + |
| 41 | + tags = local.tags |
22 | 42 | } |
23 | 43 |
|
24 | 44 | resource "aws_security_group" "allow_ssh" { |
|
0 commit comments