diff --git a/modules/aws-asg/README.md b/modules/aws-asg/README.md index 3682b90..18f5664 100644 --- a/modules/aws-asg/README.md +++ b/modules/aws-asg/README.md @@ -65,7 +65,7 @@ No modules. | [cloudwatch\_logs\_enabled](#input\_cloudwatch\_logs\_enabled) | Set to true to send '/var/log/message' logs to CloudWatch | `bool` | `true` | no | | [launch\_tmpl\_associate\_public\_ip\_address](#input\_launch\_tmpl\_associate\_public\_ip\_address) | Associate a public ip address with an instance in a VPC | `bool` | `false` | no | | [launch\_tmpl\_instance\_type](#input\_launch\_tmpl\_instance\_type) | The type of instance to use (e.g. t3.micro, t3.small, t3.medium, etc) | `string` | `"t3.small"` | no | -| [module\_version](#input\_module\_version) | Terraform module version | `string` | `"v2.0.2"` | no | +| [module\_version](#input\_module\_version) | Terraform module version | `string` | `"v2.0.3"` | no | | [nlb\_enable\_cross\_zone\_load\_balancing](#input\_nlb\_enable\_cross\_zone\_load\_balancing) | Configure cross zone load balancing for the NLB | `bool` | `false` | no | | [nlb\_subnets](#input\_nlb\_subnets) | A list of public subnet IDs to attach to the LB. Use Public Subnets only | `list(string)` | n/a | yes | | [redis\_subnets](#input\_redis\_subnets) | A list of subnet IDs to to use for the redis instances.
At least two subnets on different Availability Zones must be provided | `list(any)` | `[]` | no | diff --git a/modules/aws-asg/examples/cga-with-vpc/README.md b/modules/aws-asg/examples/cga-with-vpc/README.md index ce7f2e0..65d5bff 100644 --- a/modules/aws-asg/examples/cga-with-vpc/README.md +++ b/modules/aws-asg/examples/cga-with-vpc/README.md @@ -16,7 +16,8 @@ | Name | Source | Version | |------|--------|---------| -| [cloudgen-access-proxy](#module\_cloudgen-access-proxy) | ../../ | n/a | +| [cloudgen-access-proxy-ha](#module\_cloudgen-access-proxy-ha) | ../../ | n/a | +| [cloudgen-access-proxy-single](#module\_cloudgen-access-proxy-single) | ../../ | n/a | | [vpc](#module\_vpc) | terraform-aws-modules/vpc/aws | 3.18.1 | ## Resources @@ -29,12 +30,12 @@ | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [cloudgen\_access\_proxy\_token](#input\_cloudgen\_access\_proxy\_token) | n/a | `string` | n/a | yes | +| [cloudgen\_access\_proxy\_token](#input\_cloudgen\_access\_proxy\_token) | Using the same token on both modules for test | `string` | n/a | yes | ## Outputs | Name | Description | |------|-------------| -| [Network\_Load\_Balancer\_DNS\_Name](#output\_Network\_Load\_Balancer\_DNS\_Name) | n/a | -| [Security\_Group\_for\_Resources](#output\_Security\_Group\_for\_Resources) | n/a | +| [cloudgen-access-proxy-ha](#output\_cloudgen-access-proxy-ha) | n/a | +| [cloudgen-access-proxy-single](#output\_cloudgen-access-proxy-single) | n/a | diff --git a/modules/aws-asg/examples/cga-with-vpc/main.tf b/modules/aws-asg/examples/cga-with-vpc/main.tf index 407323a..335103c 100644 --- a/modules/aws-asg/examples/cga-with-vpc/main.tf +++ b/modules/aws-asg/examples/cga-with-vpc/main.tf @@ -2,6 +2,7 @@ # Variables # +# Using the same token on both modules for test variable "cloudgen_access_proxy_token" { type = string sensitive = true @@ -28,7 +29,52 @@ provider "aws" { # CloudGen Access Proxy # -module "cloudgen-access-proxy" { +module "cloudgen-access-proxy-single" { + source = "../../" + + # More examples + # run 'rm -rf .terraform/' after changing source + # source = "git::git@github.com:barracuda-cloudgen-access/terraform-modules.git//modules/aws-asg?ref=vx.x.x" + # source = "git::git@github.com:barracuda-cloudgen-access/terraform-modules.git//modules/aws-asg?ref=" + # source = "../" + + # CloudGen Access Proxy + cloudgen_access_proxy_public_port = 443 + cloudgen_access_proxy_token = var.cloudgen_access_proxy_token + + # AWS + aws_region = local.aws_region + + # Network Load Balancing + nlb_subnets = module.vpc.public_subnets + + # Auto Scaling Group + asg_desired_capacity = 1 + asg_min_size = 1 + asg_max_size = 1 + asg_subnets = module.vpc.private_subnets + + # Launch Configuration + launch_tmpl_instance_type = "t3.small" + + # AWS Systems Manager + ssm_parameter_store = false + + tags = { + extra_tag = "extra-value" + } +} + +output "cloudgen-access-proxy-single" { + + value = { + Network_Load_Balancer_DNS_Name = module.cloudgen-access-proxy-single.Network_Load_Balancer_DNS_Name + Security_Group_for_Resources = module.cloudgen-access-proxy-single.Security_Group_for_Resources + } +} + + +module "cloudgen-access-proxy-ha" { source = "../../" # More examples @@ -64,12 +110,12 @@ module "cloudgen-access-proxy" { } } -output "Network_Load_Balancer_DNS_Name" { - value = module.cloudgen-access-proxy.Network_Load_Balancer_DNS_Name -} +output "cloudgen-access-proxy-ha" { -output "Security_Group_for_Resources" { - value = module.cloudgen-access-proxy.Security_Group_for_Resources + value = { + Network_Load_Balancer_DNS_Name = module.cloudgen-access-proxy-ha.Network_Load_Balancer_DNS_Name + Security_Group_for_Resources = module.cloudgen-access-proxy-ha.Security_Group_for_Resources + } } # diff --git a/modules/aws-asg/main.tf b/modules/aws-asg/main.tf index dcf4b13..65b75fa 100644 --- a/modules/aws-asg/main.tf +++ b/modules/aws-asg/main.tf @@ -295,8 +295,8 @@ resource "aws_launch_template" "launch_template" { aws_region = var.aws_region, ssm_parameter_store = var.ssm_parameter_store, redis_enabled = local.redis_enabled, - redis_primary_endpoint_address = aws_elasticache_replication_group.redis[0].primary_endpoint_address, - redis_port = aws_elasticache_replication_group.redis[0].port, + redis_primary_endpoint_address = try(aws_elasticache_replication_group.redis[0].primary_endpoint_address, ""), + redis_port = try(aws_elasticache_replication_group.redis[0].port, ""), cloudgen_access_proxy_public_port = var.cloudgen_access_proxy_public_port, cloudgen_access_proxy_level = var.cloudgen_access_proxy_level, random_string_prefix_result = random_string.prefix.result, diff --git a/modules/aws-asg/variables.tf b/modules/aws-asg/variables.tf index f2cacd6..648a560 100644 --- a/modules/aws-asg/variables.tf +++ b/modules/aws-asg/variables.tf @@ -44,7 +44,7 @@ variable "cloudgen_access_proxy_level" { variable "module_version" { description = "Terraform module version" type = string - default = "v2.0.2" + default = "v2.0.3" } #