@@ -11,8 +11,6 @@ locals {
1111 vpc_cidr = " 10.0.0.0/16"
1212 azs = slice (data. aws_availability_zones . available . names , 0 , 3 )
1313
14- domain_name = " terraform-aws-modules.modules.tf"
15-
1614 tags = {
1715 Example = local.name
1816 GithubRepo = " terraform-aws-alb"
@@ -41,7 +39,7 @@ module "alb" {
4139 type = " ingress"
4240 from_port = 80
4341 to_port = 80
44- protocol = " http "
42+ protocol = " tcp "
4543 description = " HTTP web traffic"
4644 cidr_blocks = [" 0.0.0.0/0" ]
4745 }
@@ -62,10 +60,10 @@ module "alb" {
6260 }
6361 }
6462
65- # # See notes in README (ref: https://github.com/terraform-providers/terraform-provider-aws/issues/7987)
66- # access_logs = {
67- # bucket = module.log_bucket.s3_bucket_id
68- # }
63+ # # See notes in README (ref: https://github.com/terraform-providers/terraform-provider-aws/issues/7987)
64+ # access_logs = {
65+ # bucket = module.log_bucket.s3_bucket_id
66+ # }
6967
7068 http_tcp_listeners = [
7169 # Forward action is default, either when defined or undefined
@@ -135,12 +133,12 @@ module "alb" {
135133 display = " page"
136134 prompt = " login"
137135 }
138- authorization_endpoint = " https://${ local . domain_name } /auth"
136+ authorization_endpoint = " https://${ var . domain_name } /auth"
139137 client_id = " client_id"
140138 client_secret = " client_secret"
141- issuer = " https://${ local . domain_name } "
142- token_endpoint = " https://${ local . domain_name } /token"
143- user_info_endpoint = " https://${ local . domain_name } /user_info"
139+ issuer = " https://${ var . domain_name } "
140+ token_endpoint = " https://${ var . domain_name } /token"
141+ user_info_endpoint = " https://${ var . domain_name } /user_info"
144142 }
145143 },
146144 ]
@@ -189,12 +187,12 @@ module "alb" {
189187 display = " page"
190188 prompt = " login"
191189 }
192- authorization_endpoint = " https://${ local . domain_name } /auth"
190+ authorization_endpoint = " https://${ var . domain_name } /auth"
193191 client_id = " client_id"
194192 client_secret = " client_secret"
195- issuer = " https://${ local . domain_name } "
196- token_endpoint = " https://${ local . domain_name } /token"
197- user_info_endpoint = " https://${ local . domain_name } /user_info"
193+ issuer = " https://${ var . domain_name } "
194+ token_endpoint = " https://${ var . domain_name } /token"
195+ user_info_endpoint = " https://${ var . domain_name } /user_info"
198196 },
199197 {
200198 type = " forward"
@@ -460,6 +458,7 @@ data "aws_ami" "amazon_linux" {
460458resource "aws_instance" "this" {
461459 ami = data. aws_ami . amazon_linux . id
462460 instance_type = " t3.nano"
461+ subnet_id = element (module. vpc . private_subnets , 0 )
463462}
464463
465464# ############################################
@@ -525,9 +524,9 @@ module "lambda_without_allowed_triggers" {
525524 depends_on = [null_resource. download_package ]
526525}
527526
528- # #################################################################
529- # Data sources to get VPC and subnets
530- # #################################################################
527+ # ###############################################################################
528+ # Supporting resources
529+ # ###############################################################################
531530
532531module "vpc" {
533532 source = " terraform-aws-modules/vpc/aws"
@@ -548,22 +547,22 @@ module "vpc" {
548547}
549548
550549data "aws_route53_zone" "this" {
551- name = local . domain_name
550+ name = var . domain_name
552551}
553552
554553module "acm" {
555554 source = " terraform-aws-modules/acm/aws"
556555 version = " ~> 3.0"
557556
558- domain_name = local . domain_name # trimsuffix(data.aws_route53_zone.this.name, ".")
557+ domain_name = var . domain_name
559558 zone_id = data. aws_route53_zone . this . id
560559}
561560
562561module "wildcard_cert" {
563562 source = " terraform-aws-modules/acm/aws"
564563 version = " ~> 3.0"
565564
566- domain_name = " *.${ local . domain_name } " # trimsuffix(data.aws_route53_zone.this.name, ".")
565+ domain_name = " *.${ var . domain_name } "
567566 zone_id = data. aws_route53_zone . this . id
568567}
569568
@@ -580,7 +579,7 @@ resource "aws_cognito_user_pool_client" "this" {
580579 user_pool_id = aws_cognito_user_pool. this . id
581580 generate_secret = true
582581 allowed_oauth_flows = [" code" , " implicit" ]
583- callback_urls = [" https://${ local . domain_name } /callback" ]
582+ callback_urls = [" https://${ var . domain_name } /callback" ]
584583 allowed_oauth_scopes = [" email" , " openid" ]
585584 allowed_oauth_flows_user_pool_client = true
586585}
0 commit comments