@@ -6,11 +6,13 @@ provider "aws" {
66}
77
88locals {
9+ ami_prefix = " RHEL-9"
10+ aws_region = " us-east-2"
11+ cidr = " 10.80.0.0/16"
912 cluster_name = " cloud-enabled"
10- aws_region = " us-gov-west-1"
11- cidr = " 10.88.0.0/16"
13+
1214 ssh_allowed_cidrs = [
13- " 0.0.0.0/0 "
15+ " 76.185.97.220/32 "
1416 ]
1517
1618 tags = {
@@ -19,13 +21,13 @@ locals {
1921 }
2022}
2123
22- data "aws_ami" "rhel8 " {
24+ data "aws_ami" "server " {
2325 most_recent = true
24- owners = [" 219670896067 " ] # owner is specific to aws gov cloud
26+ owners = [" amazon " ]
2527
2628 filter {
2729 name = " name"
28- values = [" RHEL-8 *" ]
30+ values = [" ${ local . ami_prefix } *" ]
2931 }
3032
3133 filter {
@@ -56,8 +58,8 @@ module "vpc" {
5658 cidr = local. cidr
5759
5860 azs = [" ${ local . aws_region } a" , " ${ local . aws_region } b" , " ${ local . aws_region } c" ]
59- public_subnets = [cidrsubnet (local. cidr , 8 , 1 ), cidrsubnet (local. cidr , 8 , 2 ), cidrsubnet (local. cidr , 8 , 3 )]
60- private_subnets = [cidrsubnet (local. cidr , 8 , 101 ), cidrsubnet (local. cidr , 8 , 102 ), cidrsubnet (local. cidr , 8 , 103 )]
61+ public_subnets = [cidrsubnet (local. cidr , 8 , 0 ), cidrsubnet (local. cidr , 8 , 1 ), cidrsubnet (local. cidr , 8 , 2 )]
62+ private_subnets = [cidrsubnet (local. cidr , 8 , 10 ), cidrsubnet (local. cidr , 8 , 11 ), cidrsubnet (local. cidr , 8 , 12 )]
6163
6264 enable_nat_gateway = true
6365 single_nat_gateway = true
@@ -96,19 +98,19 @@ module "rke2" {
9698 vpc_id = module. vpc . vpc_id
9799 subnets = module. vpc . public_subnets # Note: Public subnets used for demo purposes, this is not recommended in production
98100
99- ami = data. aws_ami . rhel8 . image_id
101+ ami = data. aws_ami . server . image_id
100102 ssh_authorized_keys = [tls_private_key . ssh . public_key_openssh ]
101- instance_type = " t3.medium "
103+ instance_type = " m5a.large "
102104 controlplane_internal = false # Note this defaults to best practice of true, but is explicitly set to public for demo purposes
103105 servers = 1
104106
105107 # Enable AWS Cloud Controller Manager
106108 enable_ccm = true
107109 enable_autoscaler = true
108110
109- rke2_config = yamlencode ({ " node-label" : [" name=server" , " os=rhel8 " ] })
111+ rke2_config = yamlencode ({ " node-label" : [" name=server" , " os=rhel " ] })
110112
111- rke2_channel = " v1.27 "
113+ rke2_channel = " v1.33 "
112114}
113115
114116#
@@ -121,21 +123,21 @@ module "agents" {
121123 vpc_id = module. vpc . vpc_id
122124 subnets = module. vpc . public_subnets # Note: Public subnets used for demo purposes, this is not recommended in production
123125
124- ami = data. aws_ami . rhel8 . image_id
126+ ami = data. aws_ami . server . image_id
125127 ssh_authorized_keys = [tls_private_key . ssh . public_key_openssh ]
126128 spot = true
127- asg = { min : 1 , max : 10 , desired : 2 }
128- instance_type = " t3.large "
129+ asg = { min : 2 , max : 2 , desired : 2 }
130+ instance_type = " m5a.xlarge "
129131
130132 # Enable AWS Cloud Controller Manager and Cluster Autoscaler
131133 enable_ccm = true
132134 enable_autoscaler = true
133135
134- rke2_config = yamlencode ({ " node-label" : [" name=generic" , " os=rhel8 " ] })
136+ rke2_config = yamlencode ({ " node-label" : [" name=generic" , " os=rhel " ] })
135137
136138 cluster_data = module. rke2 . cluster_data
137139
138- rke2_channel = " v1.27 "
140+ rke2_channel = " v1.33 "
139141}
140142
141143# For demonstration only, lock down ssh access in production
0 commit comments