Skip to content

Commit ad65050

Browse files
author
James Crowley
authored
Merge pull request #25 from sourcefuse/chore/ARC-890-toggle-features
chore/ARC-890-toggle-features
2 parents 5f8b087 + 49e47e7 commit ad65050

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,3 @@ jobs:
2929

3030
- name: Run tflint
3131
run: tflint -f compact
32-

.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.2.6
1+
1.3.0

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ module "ecs" {
116116
| <a name="input_create_acm_certificate"></a> [create\_acm\_certificate](#input\_create\_acm\_certificate) | Create an ACM Certificate to use with the ALB | `bool` | `true` | no |
117117
| <a name="input_environment"></a> [environment](#input\_environment) | ID element. Usually used for region e.g. 'uw2', 'us-west-2', OR role 'prod', 'staging', 'dev', 'UAT' | `string` | n/a | yes |
118118
| <a name="input_execution_policy_attachment_arns"></a> [execution\_policy\_attachment\_arns](#input\_execution\_policy\_attachment\_arns) | The ARNs of the policies you want to apply | `list(string)` | <pre>[<br> "arn:aws:iam::aws:policy/AmazonSSMReadOnlyAccess",<br> "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy"<br>]</pre> | no |
119-
| <a name="input_health_check_route_53_private_zone"></a> [health\_check\_route\_53\_private\_zone](#input\_health\_check\_route\_53\_private\_zone) | Used with `name` field to get a private Hosted Zone | `bool` | `false` | no |
119+
| <a name="input_externally_managed_route_53_record"></a> [externally\_managed\_route\_53\_record](#input\_externally\_managed\_route\_53\_record) | If there is a Route 53 Zone externally managed from the account you are running in. If `true`, you will have to manage your DNS yourself. | `bool` | `false` | no |
120120
| <a name="input_health_check_route_53_records"></a> [health\_check\_route\_53\_records](#input\_health\_check\_route\_53\_records) | List of Route 53 records for the health check service. | `list(string)` | n/a | yes |
121121
| <a name="input_health_check_subnet_ids"></a> [health\_check\_subnet\_ids](#input\_health\_check\_subnet\_ids) | Subnet IDs for the health check tasks to run in. If not defined, this will use `var.alb_subnet_ids`. | `list(string)` | `[]` | no |
122122
| <a name="input_log_group_retention_days"></a> [log\_group\_retention\_days](#input\_log\_group\_retention\_days) | Specifies the number of days you want to retain log events in the specified log group.<br>Possible values are: 1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096,<br>1827, 2192, 2557, 2922, 3288, 3653, and 0.<br>If you select 0, the events in the log group are always retained and never expire | `number` | `30` | no |
123123
| <a name="input_log_group_skip_destroy"></a> [log\_group\_skip\_destroy](#input\_log\_group\_skip\_destroy) | Set to true if you do not wish the log group (and any logs it may contain) to be deleted at destroy time, and instead just remove the log group from the Terraform state. | `bool` | `false` | no |
124124
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Namespace your resource belongs to.<br>Usually an abbreviation of your organization name, e.g. 'example' or 'arc', to help ensure generated IDs are globally unique" | `string` | n/a | yes |
125-
| <a name="input_route_53_zone"></a> [route\_53\_zone](#input\_route\_53\_zone) | Route 53 domain to generate an ACM request for and to create A records against, i.e. sfrefarch.com. A wildcard subject alternative name is generated with the certificate. | `string` | n/a | yes |
125+
| <a name="input_route_53_zone_id"></a> [route\_53\_zone\_id](#input\_route\_53\_zone\_id) | Route 53 zone ID | `string` | `null` | no |
126+
| <a name="input_route_53_zone_name"></a> [route\_53\_zone\_name](#input\_route\_53\_zone\_name) | Route 53 domain to generate an ACM request for and to create A records against, i.e. sfrefarch.com. A wildcard subject alternative name is generated with the certificate. | `string` | `null` | no |
126127
| <a name="input_service_discovery_private_dns_namespace"></a> [service\_discovery\_private\_dns\_namespace](#input\_service\_discovery\_private\_dns\_namespace) | The name of the namespace | `list(string)` | <pre>[<br> "default.example.local"<br>]</pre> | no |
127128
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to assign the resources. | `map(string)` | `{}` | no |
128129
| <a name="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id) | Id of the VPC where the resources will live | `string` | n/a | yes |

example/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ module "ecs" {
4848
// -------------------------- END ------------------------- //
4949

5050
## create acm certificate and dns record for health check
51-
route_53_zone = local.route_53_zone
51+
route_53_zone_name = local.route_53_zone
5252
acm_domain_name = "healthcheck-ecs-${var.namespace}-${var.environment}.${local.route_53_zone}"
5353
acm_subject_alternative_names = []
5454
health_check_route_53_records = [

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module "acm" {
5757
name = "${var.environment}-${var.namespace}-acm-certificate"
5858
namespace = var.namespace
5959
environment = var.environment
60-
zone_name = var.route_53_zone
60+
zone_name = var.route_53_zone_name
6161
domain_name = var.acm_domain_name
6262
subject_alternative_names = var.acm_subject_alternative_names
6363
process_domain_validation_options = var.acm_process_domain_validation_options
@@ -156,10 +156,11 @@ module "health_check" {
156156
alb_dns_name = module.alb.alb_dns_name
157157
alb_zone_id = module.alb.alb_zone_id
158158

159-
## for internal records on health check
160-
route_53_zone_name = var.route_53_zone
159+
externally_managed_route_53_record = var.externally_managed_route_53_record
160+
161+
## health check
162+
route_53_zone_id = var.route_53_zone_id
161163
health_check_route_53_records = var.health_check_route_53_records
162-
route_53_private_zone = var.health_check_route_53_private_zone
163164

164165
task_execution_role_arn = aws_iam_role.execution.arn
165166

modules/health-check/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ AWS Terraform ALB Health Check Module
3434
| [aws_lb_target_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/lb_target_group) | resource |
3535
| [aws_route53_record.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_record) | resource |
3636
| [aws_security_group.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group) | resource |
37-
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route53_zone) | data source |
3837

3938
## Inputs
4039

@@ -44,6 +43,7 @@ AWS Terraform ALB Health Check Module
4443
| <a name="input_alb_zone_id"></a> [alb\_zone\_id](#input\_alb\_zone\_id) | ALB Route53 zone ID to create A record for health check service | `string` | n/a | yes |
4544
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | ID of the ECS cluster. | `string` | n/a | yes |
4645
| <a name="input_cluster_name"></a> [cluster\_name](#input\_cluster\_name) | Name of the ECS cluster. | `string` | n/a | yes |
46+
| <a name="input_externally_managed_route_53_record"></a> [externally\_managed\_route\_53\_record](#input\_externally\_managed\_route\_53\_record) | If there is a Route 53 Zone externally managed from the account you are running in. If `true`, you will have to manage your DNS yourself. | `bool` | `false` | no |
4747
| <a name="input_health_check_desired_count"></a> [health\_check\_desired\_count](#input\_health\_check\_desired\_count) | Number of ECS tasks to run for the health check. | `number` | `1` | no |
4848
| <a name="input_health_check_image"></a> [health\_check\_image](#input\_health\_check\_image) | Docker image used for the health-check | `string` | `"ealen/echo-server"` | no |
4949
| <a name="input_health_check_launch_type"></a> [health\_check\_launch\_type](#input\_health\_check\_launch\_type) | Launch type for the health check service. | `string` | `"FARGATE"` | no |
@@ -52,8 +52,7 @@ AWS Terraform ALB Health Check Module
5252
| <a name="input_health_check_route_53_records"></a> [health\_check\_route\_53\_records](#input\_health\_check\_route\_53\_records) | List of A record domains to create for the health check service | `list(string)` | n/a | yes |
5353
| <a name="input_lb_listener_arn"></a> [lb\_listener\_arn](#input\_lb\_listener\_arn) | ARN of the load balancer listener. | `string` | n/a | yes |
5454
| <a name="input_lb_security_group_ids"></a> [lb\_security\_group\_ids](#input\_lb\_security\_group\_ids) | LB Security Group IDs for ingress access to the health check task definition. | `list(string)` | n/a | yes |
55-
| <a name="input_route_53_private_zone"></a> [route\_53\_private\_zone](#input\_route\_53\_private\_zone) | Used with `name` field to get a private Hosted Zone | `bool` | `false` | no |
56-
| <a name="input_route_53_zone_name"></a> [route\_53\_zone\_name](#input\_route\_53\_zone\_name) | Route53 zone name used for looking up and creating an `A` record for the health check service | `string` | n/a | yes |
55+
| <a name="input_route_53_zone_id"></a> [route\_53\_zone\_id](#input\_route\_53\_zone\_id) | Route53 zone ID used for looking up and creating an `A` record for the health check service | `string` | n/a | yes |
5756
| <a name="input_subnet_ids"></a> [subnet\_ids](#input\_subnet\_ids) | Subnet IDs to run health check task in | `list(string)` | n/a | yes |
5857
| <a name="input_tags"></a> [tags](#input\_tags) | Tags to assign the resources. | `map(string)` | `{}` | no |
5958
| <a name="input_task_definition_cpu"></a> [task\_definition\_cpu](#input\_task\_definition\_cpu) | Number of cpu units used by the task. If the requires\_compatibilities is FARGATE this field is required. | `number` | `1024` | no |

modules/health-check/data.tf

Lines changed: 0 additions & 7 deletions
This file was deleted.

modules/health-check/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ resource "aws_ecs_task_definition" "this" {
146146
## route 53
147147
################################################################################
148148
resource "aws_route53_record" "this" {
149-
for_each = toset(var.health_check_route_53_records)
149+
for_each = var.externally_managed_route_53_record != true ? toset(var.health_check_route_53_records) : []
150150

151-
zone_id = data.aws_route53_zone.this.id
151+
zone_id = var.route_53_zone_id
152152
name = each.value
153153
type = var.health_check_route_53_record_type
154154

modules/health-check/variables.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ variable "alb_zone_id" {
9696
description = "ALB Route53 zone ID to create A record for health check service"
9797
}
9898

99-
variable "route_53_zone_name" {
99+
variable "route_53_zone_id" {
100100
type = string
101-
description = "Route53 zone name used for looking up and creating an `A` record for the health check service"
101+
description = "Route53 zone ID used for looking up and creating an `A` record for the health check service"
102102
}
103103

104104
################################################################################
@@ -117,8 +117,8 @@ variable "lb_listener_arn" {
117117
################################################################################
118118
## route 53
119119
################################################################################
120-
variable "route_53_private_zone" {
120+
variable "externally_managed_route_53_record" {
121121
type = bool
122-
description = "Used with `name` field to get a private Hosted Zone"
122+
description = "If there is a Route 53 Zone externally managed from the account you are running in. If `true`, you will have to manage your DNS yourself."
123123
default = false
124124
}

variables.tf

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,19 +75,26 @@ variable "health_check_subnet_ids" {
7575
default = []
7676
}
7777

78-
variable "route_53_zone" {
78+
variable "route_53_zone_id" {
79+
type = string
80+
description = "Route 53 zone ID"
81+
default = null
82+
}
83+
84+
variable "route_53_zone_name" {
7985
type = string
8086
description = "Route 53 domain to generate an ACM request for and to create A records against, i.e. sfrefarch.com. A wildcard subject alternative name is generated with the certificate."
87+
default = null
8188
}
8289

8390
variable "health_check_route_53_records" {
8491
type = list(string)
8592
description = "List of Route 53 records for the health check service."
8693
}
8794

88-
variable "health_check_route_53_private_zone" {
95+
variable "externally_managed_route_53_record" {
8996
type = bool
90-
description = "Used with `name` field to get a private Hosted Zone"
97+
description = "If there is a Route 53 Zone externally managed from the account you are running in. If `true`, you will have to manage your DNS yourself."
9198
default = false
9299
}
93100

0 commit comments

Comments
 (0)