Skip to content

Commit 1f512ae

Browse files
committed
Add examples
1 parent 7e30531 commit 1f512ae

File tree

9 files changed

+150
-57
lines changed

9 files changed

+150
-57
lines changed

examples/basic/README.md

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ Run `terraform destroy` to clean up them.
1717

1818
## Requirements
1919

20-
| Name | Version |
21-
|------|---------|
22-
| aws | ~> 2.61 |
20+
No requirements.
2321

2422
## Providers
2523

examples/basic/main.tf

+28-22
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
module "acm" {
2-
source = "../../"
2+
source = "../../"
33

4-
domain_name = {
5-
zone = "example.com"
6-
domain = "example.com"
7-
}
8-
subject_alternative_names = [
9-
{
10-
zone = "example.com"
11-
domain = "*.example.com"
12-
},
13-
{
14-
zone = "example.org"
15-
domain = "example.org"
16-
},
17-
{
18-
zone = "example.org"
19-
domain = "*.example.org"
20-
}
21-
]
4+
providers = {
5+
aws.route53 = aws
6+
aws.acm = aws
7+
}
8+
9+
domain_name = {
10+
zone = "example.com"
11+
domain = "example.com"
12+
}
2213

23-
tags = {
24-
Name = "ACM certificate with multiple hosted zones"
14+
subject_alternative_names = [
15+
{
16+
zone = "example.com"
17+
domain = "*.example.com"
18+
},
19+
{
20+
zone = "example.org"
21+
domain = "example.org"
22+
},
23+
{
24+
zone = "example.org"
25+
domain = "*.example.org"
2526
}
26-
}
27+
]
28+
29+
tags = {
30+
Name = "ACM certificate with multiple hosted zones"
31+
}
32+
}

examples/basic/providers.tf

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
provider "aws" {
2-
version = "~> 2.61"
3-
region = "us-west-2"
4-
}
5-
1+
provider "aws" {
2+
region = "us-west-2"
3+
}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Terraform AWS ACM Multiple Hosted Zone Example
2+
3+
This example provides guides on how to use terraform-aws-acm-multiple-hosted-zone module involving multiple AWS accounts.
4+
To be precise, the ACM certificate will be provisioned in a certain AWS account while the domain are hosted in another AWS account.
5+
6+
## Usage
7+
8+
To run this example you need to execute:
9+
10+
```terraform
11+
terraform init
12+
terraform plan -out=tfplan.out
13+
terraform apply tfplan.out
14+
```
15+
16+
Note that this example may create resources that cost money.
17+
Run `terraform destroy` to clean up them.
18+
19+
## Requirements
20+
21+
No requirements.
22+
23+
## Providers
24+
25+
No provider.
26+
27+
## Inputs
28+
29+
No input.
30+
31+
## Outputs
32+
33+
| Name | Description |
34+
|------|-------------|
35+
| certificate\_arn | n/a |
36+
| certificate\_domains | n/a |
+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
module "acm" {
2+
source = "../../"
3+
4+
providers = {
5+
aws.route53 = aws.production
6+
aws.acm = aws.staging
7+
}
8+
9+
domain_name = {
10+
zone = "example.com"
11+
domain = "example.com"
12+
}
13+
14+
subject_alternative_names = [
15+
{
16+
zone = "example.com"
17+
domain = "*.example.com"
18+
},
19+
{
20+
zone = "example.org"
21+
domain = "example.org"
22+
},
23+
{
24+
zone = "example.org"
25+
domain = "*.example.org"
26+
}
27+
]
28+
29+
tags = {
30+
Name = "ACM certificate with multiple hosted zones and multiple AWS accounts"
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
output "certificate_arn" {
2+
value = module.acm.certificate_arn
3+
}
4+
5+
output "certificate_domains" {
6+
value = module.acm.certificate_domains
7+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
provider "aws" {
2+
region = "us-west-2"
3+
profile = "production"
4+
alias = "production"
5+
}
6+
7+
provider "aws" {
8+
alias = "staging"
9+
region = "us-west-2"
10+
profile = "staging"
11+
}
+29-23
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,34 @@
11
module "acm" {
2-
source = "../../"
2+
source = "../../"
33

4-
domain_name = {
5-
zone = "example.com"
6-
domain = "example.com"
7-
}
8-
subject_alternative_names = [
9-
{
10-
zone = "example.com"
11-
domain = "*.example.com"
12-
},
13-
{
14-
zone = "example.org"
15-
domain = "example.org"
16-
},
17-
{
18-
zone = "example.org"
19-
domain = "*.example.org"
20-
}
21-
]
4+
providers = {
5+
aws.acm = aws
6+
aws.route53 = aws
7+
}
228

23-
validation_set_records = false
9+
domain_name = {
10+
zone = "example.com"
11+
domain = "example.com"
12+
}
2413

25-
tags = {
26-
Name = "ACM request without setting validation records on Route53"
14+
subject_alternative_names = [
15+
{
16+
zone = "example.com"
17+
domain = "*.example.com"
18+
},
19+
{
20+
zone = "example.org"
21+
domain = "example.org"
22+
},
23+
{
24+
zone = "example.org"
25+
domain = "*.example.org"
2726
}
28-
}
27+
]
28+
29+
validation_set_records = false
30+
31+
tags = {
32+
Name = "ACM request without setting validation records on Route53"
33+
}
34+
}
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
provider "aws" {
2-
version = "~> 2.61"
3-
region = "us-west-2"
4-
}
1+
provider "aws" {
2+
region = "us-west-2"
3+
}

0 commit comments

Comments
 (0)