Skip to content

Commit 8d052a6

Browse files
authored
Add ability to specify key_algorithm closes #69 (#74)
Signed-off-by: Joke de Buhr <joke@xckk.de>
1 parent dc3e288 commit 8d052a6

File tree

6 files changed

+110
-208
lines changed

6 files changed

+110
-208
lines changed

README.md

Lines changed: 92 additions & 197 deletions
Large diffs are not rendered by default.

docs/terraform.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
| Name | Version |
55
|------|---------|
66
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13 |
7-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 3.0 |
7+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.40 |
88

99
## Providers
1010

1111
| Name | Version |
1212
|------|---------|
13-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 3.0 |
13+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.40 |
1414

1515
## Modules
1616

@@ -42,6 +42,7 @@
4242
| <a name="input_enabled"></a> [enabled](#input\_enabled) | Set to false to prevent the module from creating any resources | `bool` | `null` | no |
4343
| <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` | `null` | no |
4444
| <a name="input_id_length_limit"></a> [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).<br>Set to `0` for unlimited length.<br>Set to `null` for keep the existing setting, which defaults to `0`.<br>Does not affect `id_full`. | `number` | `null` | no |
45+
| <a name="input_key_algorithm"></a> [key\_algorithm](#input\_key\_algorithm) | Specifies the algorithm of the public and private key pair that your Amazon issued certificate uses to encrypt data | `string` | `null` | no |
4546
| <a name="input_label_key_case"></a> [label\_key\_case](#input\_label\_key\_case) | Controls the letter case of the `tags` keys (label names) for tags generated by this module.<br>Does not affect keys of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper`.<br>Default value: `title`. | `string` | `null` | no |
4647
| <a name="input_label_order"></a> [label\_order](#input\_label\_order) | The order in which the labels (ID elements) appear in the `id`.<br>Defaults to ["namespace", "environment", "stage", "name", "attributes"].<br>You can omit any of the 6 labels ("tenant" is the 6th), but at least one must be present. | `list(string)` | `null` | no |
4748
| <a name="input_label_value_case"></a> [label\_value\_case](#input\_label\_value\_case) | Controls the letter case of ID elements (labels) as included in `id`,<br>set as tag values, and output by this module individually.<br>Does not affect values of tags passed in via the `tags` input.<br>Possible values: `lower`, `title`, `upper` and `none` (no transformation).<br>Set this to `title` and set `delimiter` to `""` to yield Pascal Case IDs.<br>Default value: `lower`. | `string` | `null` | no |

main.tf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
22
enabled = module.this.enabled
33
process_domain_validation_options = local.enabled && var.process_domain_validation_options && var.validation_method == "DNS"
4-
domain_validation_options_set = local.process_domain_validation_options ? aws_acm_certificate.default.0.domain_validation_options : toset([])
4+
domain_validation_options_set = local.process_domain_validation_options ? aws_acm_certificate.default[0].domain_validation_options : toset([])
55
public_enabled = var.certificate_authority_arn == null
66
private_enabled = !local.public_enabled
77

@@ -23,6 +23,7 @@ resource "aws_acm_certificate" "default" {
2323
validation_method = local.public_enabled ? var.validation_method : null
2424
subject_alternative_names = var.subject_alternative_names
2525
certificate_authority_arn = var.certificate_authority_arn
26+
key_algorithm = var.key_algorithm
2627

2728
options {
2829
certificate_transparency_logging_preference = var.certificate_transparency_logging_preference ? "ENABLED" : "DISABLED"
@@ -60,6 +61,6 @@ resource "aws_route53_record" "default" {
6061

6162
resource "aws_acm_certificate_validation" "default" {
6263
count = local.process_domain_validation_options && var.wait_for_certificate_issued ? 1 : 0
63-
certificate_arn = join("", aws_acm_certificate.default.*.arn)
64+
certificate_arn = join("", aws_acm_certificate.default[*].arn)
6465
validation_record_fqdns = [for record in aws_route53_record.default : record.fqdn]
6566
}

outputs.tf

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
output "id" {
2-
value = join("", aws_acm_certificate.default.*.id)
2+
value = join("", aws_acm_certificate.default[*].id)
33
description = "The ID of the certificate"
44
}
55

66
output "arn" {
7-
value = join("", aws_acm_certificate.default.*.arn)
7+
value = join("", aws_acm_certificate.default[*].arn)
88
description = "The ARN of the certificate"
99
}
1010

1111
output "domain_validation_options" {
12-
value = aws_acm_certificate.default.*.domain_validation_options
12+
value = aws_acm_certificate.default[*].domain_validation_options
1313
description = "CNAME records that are added to the DNS zone to complete certificate validation"
1414
}
1515

1616
output "validation_id" {
17-
value = join("", aws_acm_certificate_validation.default.*.id)
17+
value = join("", aws_acm_certificate_validation.default[*].id)
1818
description = "The ID of the certificate validation"
1919
}
2020

2121
output "validation_certificate_arn" {
22-
value = join("", aws_acm_certificate_validation.default.*.certificate_arn)
22+
value = join("", aws_acm_certificate_validation.default[*].certificate_arn)
2323
description = "Certificate ARN from the `aws_acm_certificate_validation` resource"
2424
}
25-

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,9 @@ variable "certificate_authority_arn" {
6666
default = null
6767
description = "ARN of an ACM PCA"
6868
}
69+
70+
variable "key_algorithm" {
71+
type = string
72+
default = null
73+
description = "Specifies the algorithm of the public and private key pair that your Amazon issued certificate uses to encrypt data"
74+
}

versions.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 3.0"
7+
version = ">= 4.40"
88
}
99
}
1010
}

0 commit comments

Comments
 (0)