-
-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: Added validation_option configuration and upgraded AWS provide…
…r to v4 (#106)
- Loading branch information
1 parent
3e88a71
commit 0825e18
Showing
9 changed files
with
152 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
examples/complete-email-validation-with-validation-domain/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
# Complete ACM example with EMAIL validation with validation_domain configured | ||
|
||
Configuration in this directory creates new Route53 zone and ACM certificate (valid for the domain name and wildcard). | ||
|
||
ACM certificate will be created with EMAIL validation method, which means that emails will be send to domain owners and it is not possible to automate using Terraform! | ||
The validation domain option is set, which overrides the domain to which validation emails will be sent. | ||
|
||
If you want to use EMAIL validation method make sure that you have access to at least one of these emails in your domain: | ||
|
||
``` | ||
hostmaster@VALIDATION_DOMAIN | ||
postmaster@VALIDATION_DOMAIN | ||
admin@VALIDATION_DOMAIN | ||
administrator@VALIDATION_DOMAIN | ||
webmaster@VALIDATION_DOMAIN | ||
``` | ||
|
||
## Usage | ||
|
||
To run this example you need to execute: | ||
|
||
```bash | ||
$ terraform init | ||
$ terraform plan -var 'domain_name=foo.bar.com' -var 'validation_domain=bar.com' | ||
$ terraform apply -var 'domain_name=foo.bar.com' -var 'validation_domain=bar.com' | ||
``` | ||
|
||
Note that this example may create resources which cost money. Run `terraform destroy` when you don't need these resources. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Requirements | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 | | ||
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.12.0 | | ||
|
||
## Providers | ||
|
||
| Name | Version | | ||
|------|---------| | ||
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.12.0 | | ||
|
||
## Modules | ||
|
||
| Name | Source | Version | | ||
|------|--------|---------| | ||
| <a name="module_acm"></a> [acm](#module\_acm) | ../../ | n/a | | ||
|
||
## Resources | ||
|
||
| Name | Type | | ||
|------|------| | ||
| [aws_route53_zone.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_zone) | resource | | ||
|
||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| <a name="input_domain_name"></a> [domain\_name](#input\_domain\_name) | Domain name to use as Route53 zone and ACM certificate | `string` | n/a | yes | | ||
| <a name="input_validation_domain"></a> [validation\_domain](#input\_validation\_domain) | Domain name to use for verifying var.domain\_name | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| <a name="output_acm_certificate_arn"></a> [acm\_certificate\_arn](#output\_acm\_certificate\_arn) | The ARN of the certificate | | ||
| <a name="output_acm_certificate_domain_validation_options"></a> [acm\_certificate\_domain\_validation\_options](#output\_acm\_certificate\_domain\_validation\_options) | A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if DNS-validation was used. | | ||
| <a name="output_acm_certificate_validation_emails"></a> [acm\_certificate\_validation\_emails](#output\_acm\_certificate\_validation\_emails) | A list of addresses that received a validation E-Mail. Only set if EMAIL-validation was used. | | ||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
27 changes: 27 additions & 0 deletions
27
examples/complete-email-validation-with-validation-domain/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
resource "aws_route53_zone" "this" { | ||
name = var.domain_name | ||
} | ||
|
||
module "acm" { | ||
source = "../../" | ||
|
||
domain_name = var.domain_name | ||
zone_id = aws_route53_zone.this.zone_id | ||
|
||
# The key is the domain name which you want to change the validation domain for. | ||
# Validation emails will be send to a fixed list of recipients: | ||
# admin@VALIDATION_DOMAIN, administrator@VALIDATION_DOMAIN, hostmaster@VALIDATION_DOMAIN, postmaster@VALIDATION_DOMAIN, webmaster@VALIDATION_DOMAIN | ||
# validation_domain has to be a top-level domain of the actual domain | ||
validation_option = { | ||
(var.domain_name) = { | ||
validation_domain = var.validation_domain | ||
} | ||
} | ||
|
||
validation_method = "EMAIL" | ||
wait_for_validation = false | ||
|
||
tags = { | ||
Name = var.domain_name | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
examples/complete-email-validation-with-validation-domain/outputs.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
output "acm_certificate_arn" { | ||
description = "The ARN of the certificate" | ||
value = module.acm.acm_certificate_arn | ||
} | ||
|
||
output "acm_certificate_domain_validation_options" { | ||
description = "A list of attributes to feed into other resources to complete certificate validation. Can have more than one element, e.g. if SANs are defined. Only set if DNS-validation was used." | ||
value = module.acm.acm_certificate_domain_validation_options | ||
} | ||
|
||
output "acm_certificate_validation_emails" { | ||
description = "A list of addresses that received a validation E-Mail. Only set if EMAIL-validation was used." | ||
value = module.acm.acm_certificate_validation_emails | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/complete-email-validation-with-validation-domain/variables.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "domain_name" { | ||
description = "Domain name to use as Route53 zone and ACM certificate" | ||
type = string | ||
} | ||
|
||
variable "validation_domain" { | ||
description = "Domain name to use for verifying var.domain_name" | ||
type = string | ||
} |
10 changes: 10 additions & 0 deletions
10
examples/complete-email-validation-with-validation-domain/versions.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
terraform { | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 4.12.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
terraform { | ||
required_version = ">= 0.13.1" | ||
required_version = ">= 1.0" | ||
|
||
required_providers { | ||
aws = { | ||
source = "hashicorp/aws" | ||
version = ">= 2.53" | ||
version = ">= 4.12.0" | ||
} | ||
} | ||
} |