Skip to content

Commit 6d128a0

Browse files
committed
feat: Add EC2 Instance Connect Endpoint support
1 parent d19622a commit 6d128a0

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

examples/ec2-instance-connect-endpoint/main.tf

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,44 @@
11
provider "aws" {
2+
region = local.region
3+
}
4+
5+
data "aws_availability_zones" "available" {}
6+
7+
locals {
8+
name = "ex-${basename(path.cwd)}"
29
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+
}
317
}
418

19+
################################################################################
20+
# EC2 Instance Connect Endpoint Example
21+
################################################################################
22+
523
module "vpc" {
624
source = "../../"
725

8-
name = "example-vpc"
26+
name = local.name
927
cidr = "10.0.0.0/16"
1028

11-
azs = ["us-east-1a", "us-east-1b"]
29+
azs = local.azs
1230
private_subnets = ["10.0.1.0/24", "10.0.2.0/24"]
1331
public_subnets = ["10.0.101.0/24", "10.0.102.0/24"]
1432

1533
enable_nat_gateway = true
1634
single_nat_gateway = true
1735

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
2242
}
2343

2444
resource "aws_security_group" "allow_ssh" {
Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +0,0 @@
1-
variable "region" {
2-
description = "AWS region for the example"
3-
type = string
4-
default = "us-east-1"
5-
}

0 commit comments

Comments
 (0)