Skip to content

Commit a8f42ea

Browse files
committed
doc: rewrote example
1 parent 0e48018 commit a8f42ea

File tree

7 files changed

+75
-103
lines changed

7 files changed

+75
-103
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ module "test" {
115115
If you wanna use this project in production (like me...), I thinks that you should follow this tricks:
116116

117117
1. fork this project into your entrprise git server and add a remote branch 'github' to this repository
118-
2. try the simple example (without Route53 record, etc), make few test, and add your lovely domain name according your dns naming convention and ACME management rules.
119118
3. publish a dummy terraform module, see how it's managed in the dynamodb
120119
4. integrate the python client into your ci
121120

example/registry-complete/.terraform-version

Lines changed: 0 additions & 1 deletion
This file was deleted.

example/registry-complete/main.tf

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

example/registry-complete/provider.tf

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

example/registry-complete/terragrunt.hcl

Whitespace-only changes.

example/registry/main.tf

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
1+
locals {
2+
root_domain_name = "my-domain.com"
3+
registry_domain_name = "registry.${local.root_domain_name}"
4+
}
5+
6+
7+
data "aws_route53_zone" "selected" {
8+
name = local.root_domain_name
9+
}
10+
11+
# create ACME Certificat
12+
13+
resource "aws_acm_certificate" "certificate" {
14+
domain_name = local.registry_domain_name
15+
validation_method = "DNS"
16+
lifecycle {
17+
create_before_destroy = true
18+
}
19+
}
20+
# create DNS record for validate
21+
resource "aws_route53_record" "certificate" {
22+
allow_overwrite = true
23+
name = tolist(aws_acm_certificate.certificate.domain_validation_options)[0].resource_record_name
24+
records = [tolist(aws_acm_certificate.certificate.domain_validation_options)[0].resource_record_value]
25+
type = tolist(aws_acm_certificate.certificate.domain_validation_options)[0].resource_record_type
26+
zone_id = data.aws_route53_zone.selected.zone_id
27+
ttl = 60
28+
}
29+
30+
# Validate certificat
31+
resource "aws_acm_certificate_validation" "certificate" {
32+
certificate_arn = aws_acm_certificate.certificate.arn
33+
validation_record_fqdns = [aws_route53_record.certificate.fqdn]
34+
}
35+
136

237
module "registry" {
338
source = "../..//"
439
name_prefix = "registry"
40+
41+
storage = {
42+
dynamodb = {
43+
name : "my-domain-registry-tfe"
44+
billing_mode : "PROVISIONED"
45+
read : 5
46+
write : 1
47+
}
48+
bucket = {
49+
name : "my-domain-registry-tfe"
50+
}
51+
}
52+
53+
friendly_hostname = {
54+
host = local.registry_domain_name
55+
acm_certificate_arn = aws_acm_certificate.certificate.arn
56+
}
57+
58+
tags = {
59+
Product : "Registry"
60+
ProductComponent : "terraform"
61+
}
62+
63+
depends_on = [aws_acm_certificate.certificate]
64+
}
65+
66+
67+
resource "aws_route53_record" "registry" {
68+
zone_id = data.aws_route53_zone.selected.zone_id
69+
70+
name = "${local.registry_domain_name}."
71+
type = "A"
72+
alias {
73+
name = module.registry.dns_alias.hostname
74+
zone_id = module.registry.dns_alias.route53_zone_id
75+
evaluate_target_health = true
76+
}
77+
78+
depends_on = [module.registry]
579
}
80+
File renamed without changes.

0 commit comments

Comments
 (0)