Skip to content

Commit ed474b6

Browse files
committed
bug: added enable variable
1 parent e42a17a commit ed474b6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

main.tf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module "labels" {
1515
## The ACM certificate resource allows requesting and management of certificates from the Amazon Certificate Manager.
1616
##----------------------------------------------------------------------------------
1717
resource "aws_acm_certificate" "import-cert" {
18-
count = var.enable_acm_certificate && var.import_certificate ? 1 : 0
18+
count = var.enable && var.import_certificate ? 1 : 0
1919

2020
private_key = file(var.private_key)
2121
certificate_body = file(var.certificate_body)
@@ -40,7 +40,7 @@ resource "aws_acm_certificate" "import-cert" {
4040
## The ACM certificate resource allows requesting and management of certificates from the Amazon Certificate Manager.
4141
##----------------------------------------------------------------------------------
4242
resource "aws_acm_certificate" "cert" {
43-
count = var.enable_acm_certificate && var.enable_aws_certificate ? 1 : 0
43+
count = var.enable && var.enable_aws_certificate ? 1 : 0
4444

4545
domain_name = var.domain_name
4646
validation_method = var.validation_method
@@ -65,7 +65,7 @@ resource "aws_acm_certificate" "cert" {
6565
## Most commonly, this resource is used together with aws_route53_record and aws_acm_certificate to request a DNS validated certificate, deploy the required validation records and wait for validation to complete.
6666
##----------------------------------------------------------------------------------
6767
resource "aws_acm_certificate_validation" "cert" {
68-
count = var.validate_certificate ? 1 : 0
68+
count = var.enable && var.validate_certificate ? 1 : 0
6969
certificate_arn = join("", aws_acm_certificate.cert[*].arn)
7070
validation_record_fqdns = flatten([aws_route53_record.default[*].fqdn, var.validation_record_fqdns])
7171

@@ -75,7 +75,7 @@ resource "aws_acm_certificate_validation" "cert" {
7575
## A hosted zone is analogous to a traditional DNS zone file; it represents a collection of records that can be managed together, belonging to a single parent domain name.
7676
##----------------------------------------------------------------------------------
7777
data "aws_route53_zone" "default" {
78-
count = var.enable_dns_validation ? 1 : 0
78+
count = var.enable && var.enable_dns_validation ? 1 : 0
7979

8080
name = var.domain_name
8181
private_zone = var.private_zone
@@ -85,7 +85,7 @@ data "aws_route53_zone" "default" {
8585
## A Route 53 record contains authoritative DNS information for a specified DNS name. DNS records are most commonly used to map a name to an IP Address..
8686
##----------------------------------------------------------------------------------
8787
resource "aws_route53_record" "default" {
88-
count = var.enable_dns_validation ? 1 : 0
88+
count = var.enable && var.enable_dns_validation ? 1 : 0
8989

9090
zone_id = join("", data.aws_route53_zone.default[*].zone_id)
9191
ttl = var.ttl
@@ -99,7 +99,7 @@ resource "aws_route53_record" "default" {
9999
## Most commonly, this resource is used together with aws_route53_record and aws_acm_certificate to request a DNS validated certificate, deploy the required validation records and wait for validation to complete.
100100
##----------------------------------------------------------------------------------
101101
resource "aws_acm_certificate_validation" "default" {
102-
count = var.enable_dns_validation ? 1 : 0
102+
count = var.enable && var.enable_dns_validation ? 1 : 0
103103

104104
certificate_arn = join("", aws_acm_certificate.cert[*].arn)
105105
validation_record_fqdns = aws_route53_record.default[*].fqdn

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ variable "enable_dns_validation" {
5656
description = "Set to prevent validation of DNS."
5757
}
5858

59-
variable "enable_acm_certificate" {
59+
variable "enable" {
6060
type = bool
6161
default = true
62-
description = "Set to false to prevent the creation of a acm certificate."
62+
description = "Whether or not to enable the entire module or not."
6363
}
6464

6565
variable "private_key" {

0 commit comments

Comments
 (0)