File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ # Development-IaC
2+
3+ == Summary
4+ This terraform play is designed to create a working development VPC for the user. It will create the following resources:
5+
6+ - Three Public subnets
7+ - Three Private subnets "no nat to simulate airgapped"
8+ - s3 vpc_endpoint
9+ - ec2 vpc_endpoint
10+ - elb vpc_endpoint
11+ - Route 53 private zone
12+ - Security Groups
13+ - Bastion ec2 Instance
14+ - Registry ec2 Instance
15+
16+ == Requirement
17+ - Setup your aws credentials
18+
19+ == Setup the variable file
20+ .Table Mandatory Variables
21+ |===
22+ | Variable | Default | Comments (type)
23+
24+ |aws_ssh_key
25+ |abc
26+ |AWS user key name
27+
28+ |ssh_public_key
29+ |string
30+ |Public ssh key. Can be drived from cat /home/ec2-user/authorized_keys
31+
32+ |rhcos_ami
33+ |ami-XXXXXXXX
34+ |RH CoreOS AMI ID
35+
36+ |vpc_id
37+ |vpc-name
38+ |The vpc name
39+
40+ |cluster_name
41+ |cluster
42+ |The cluster name
43+
44+ |cluster_domain
45+ |example.io
46+ |The cluster domain
47+
48+ |cidr_blocks
49+ |10.0.0.0/16
50+ |Any private cidr scheme
51+
52+ |aws_region
53+ |us-gov-west-1
54+ |Aws region
55+
56+ |default_tag
57+ |
58+ |Leave blank it will us the cluster_name to set tags
59+
60+ |aws_azs
61+ |"a", "b", "c"
62+ |This will align with the aws availability zones
63+
64+ |aws_availability_zones
65+ |us-gov-west-1a
66+ |This is the AZ for the public subnet
67+
68+ |vpc_private_subnet_cidrs
69+ |"10.0.1.0/24","10.0.2.0/24","10.0.3.0/24
70+ |Private CIDR block
71+
72+ |vpc_public_subnet_cidr
73+ |10.0.7.0/26", "10.0.8.0/26", "10.0.9.0/26"
74+ |Public CIDR block
75+
76+ |===
77+
78+ == Prereqs
79+
80+ The user will need to provide the following:
81+
82+ - Aws ssh key for the bastion
83+ - AMI Ids for Rhel 8 and Rhcos images
84+
85+ == Step 1
86+ Download the git to your local machine:
87+ ```
88+ git clone https://github.com/CodeSparta/devkit-vpc.git
89+ cd devkit-vpc
90+ - Setup your variables.tf
91+ vi variables.tf
92+
93+ - exec into the container and deploy
94+ bash tools/dev.sh
95+ ./devkit-build-vpc.sh -vv -e aws_access_key=xxxxxxxxxxxxx -e aws_secret_key=XXXXXXXXXXXXXXXXX -e aws_cloud_region=us-gov-west-1
96+
97+
98+ ```
99+
100+ == Step 2
101+ To destroy the IaC run:
102+ ```
103+ cd into git repo
104+ bash tools/dev.sh
105+ ./breakdown.yml -vv
106+ ```
107+ All resources not created from the IaC must be deleted prior to destroying the vpc.
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -2,12 +2,12 @@ data "aws_vpc" "cluster_vpc" {
22 id = var. vpc_id
33}
44
5- data "aws_subnet_ids" "private " {
5+ data "aws_subnet_ids" "public " {
66 vpc_id = data. aws_vpc . cluster_vpc . id
77
88 filter {
99 name = " tag:Name"
10- values = [" *private *" ]
10+ values = [" *public *" ]
1111 }
1212}
1313
@@ -16,8 +16,8 @@ resource "random_id" "index" {
1616}
1717
1818locals {
19- subnet_ids_list = tolist (data. aws_subnet_ids . private . ids )
20- subnet_ids_random_index = random_id. index . dec % length (data. aws_subnet_ids . private . ids )
19+ subnet_ids_list = tolist (data. aws_subnet_ids . public . ids )
20+ subnet_ids_random_index = random_id. index . dec % length (data. aws_subnet_ids . public . ids )
2121 instance_subnet_id = local. subnet_ids_list [local . subnet_ids_random_index ]
2222}
2323
@@ -34,7 +34,7 @@ resource "aws_instance" "registry-node" {
3434
3535 root_block_device { volume_size = var. registry_volume }
3636 security_groups = var. registry_sg_ids
37- associate_public_ip_address = false
37+ associate_public_ip_address = true
3838
3939 tags = merge (
4040 var. default_tags ,
Original file line number Diff line number Diff line change @@ -157,26 +157,3 @@ resource "aws_vpc_endpoint" "elasticloadbalancing" {
157157 )
158158 )
159159}
160-
161- data "aws_vpc_endpoint_service" "sts" {
162- service = " sts"
163- }
164-
165- resource "aws_vpc_endpoint" "sts" {
166- vpc_id = aws_vpc. cluster_vpc . id
167- service_name = data. aws_vpc_endpoint_service . sts . service_name
168- vpc_endpoint_type = " Interface"
169- private_dns_enabled = true
170-
171- security_group_ids = [
172- aws_security_group . private_ec2_api . id
173- ]
174-
175- subnet_ids = aws_subnet. pri_subnet . * . id
176- tags = merge (
177- var. default_tags ,
178- map (
179- " Name" , " ${ var . cluster_name } -sts-vpce"
180- )
181- )
182- }
You can’t perform that action at this time.
0 commit comments