Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
terraform-aws-route53
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Terraform Modules
terraform-aws-route53
Commits
abaab05d
Unverified
Commit
abaab05d
authored
Apr 13, 2021
by
Takumi Takahashi
Committed by
GitHub
Apr 13, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Add support for failover_routing_policy and health_check_id (#33)
parent
e35eb785
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
10 deletions
+57
-10
pre-commit.yml
.github/workflows/pre-commit.yml
+1
-1
README.md
examples/complete/README.md
+6
-2
main.tf
examples/complete/main.tf
+36
-2
main.tf
modules/records/main.tf
+14
-5
No files found.
.github/workflows/pre-commit.yml
View file @
abaab05d
...
@@ -94,7 +94,7 @@ jobs:
...
@@ -94,7 +94,7 @@ jobs:
-
name
:
Install pre-commit dependencies
-
name
:
Install pre-commit dependencies
run
:
|
run
:
|
pip install pre-commit
pip install pre-commit
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12
.0
-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-docs/terraform-docs/releases/latest | grep -o -E "https://.+?-v0.12
\..+?
-linux-amd64" | head -n1)" > terraform-docs && chmod +x terraform-docs && sudo mv terraform-docs /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
curl -L "$(curl -s https://api.github.com/repos/terraform-linters/tflint/releases/latest | grep -o -E "https://.+?_linux_amd64.zip")" > tflint.zip && unzip tflint.zip && rm tflint.zip && sudo mv tflint /usr/bin/
-
name
:
Execute pre-commit
-
name
:
Execute pre-commit
# Run all pre-commit checks on max version supported
# Run all pre-commit checks on max version supported
...
...
examples/complete/README.md
View file @
abaab05d
...
@@ -24,7 +24,9 @@ Note that this example may create resources which cost money. Run `terraform des
...
@@ -24,7 +24,9 @@ Note that this example may create resources which cost money. Run `terraform des
## Providers
## Providers
No providers.
| Name | Version |
|------|---------|
|
<a
name=
"provider_aws"
></a>
[
aws
](
#provider\_aws
)
| >= 2.49 |
## Modules
## Modules
...
@@ -40,7 +42,9 @@ No providers.
...
@@ -40,7 +42,9 @@ No providers.
## Resources
## Resources
No resources.
| Name | Type |
|------|------|
|
[
aws_route53_health_check.failover
](
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/route53_health_check
)
| resource |
## Inputs
## Inputs
...
...
examples/complete/main.tf
View file @
abaab05d
...
@@ -75,7 +75,7 @@ module "records" {
...
@@ -75,7 +75,7 @@ module "records" {
{
{
name
=
"test"
name
=
"test"
type
=
"CNAME"
type
=
"CNAME"
ttl
=
"5"
ttl
=
5
records
=
[
"test.example.com."
]
records
=
[
"test.example.com."
]
set_identifier
=
"test-primary"
set_identifier
=
"test-primary"
weighted_routing_policy
=
{
weighted_routing_policy
=
{
...
@@ -85,12 +85,37 @@ module "records" {
...
@@ -85,12 +85,37 @@ module "records" {
{
{
name
=
"test"
name
=
"test"
type
=
"CNAME"
type
=
"CNAME"
ttl
=
"5"
ttl
=
5
records
=
[
"test2.example.com."
]
records
=
[
"test2.example.com."
]
set_identifier
=
"test-secondary"
set_identifier
=
"test-secondary"
weighted_routing_policy
=
{
weighted_routing_policy
=
{
weight
=
10
weight
=
10
}
}
},
{
name
=
"failover-primary"
type
=
"A"
set_identifier
=
"failover-primary"
health_check_id
=
aws_route53_health_check
.
failover
.
id
alias
=
{
name
=
module
.
cloudfront
.
this_cloudfront_distribution_domain_name
zone_id
=
module
.
cloudfront
.
this_cloudfront_distribution_hosted_zone_id
}
failover_routing_policy
=
{
type
=
"PRIMARY"
}
},
{
name
=
"failover-secondary"
type
=
"A"
set_identifier
=
"failover-secondary"
alias
=
{
name
=
module
.
s3_bucket
.
this_s3_bucket_website_domain
zone_id
=
module
.
s3_bucket
.
this_s3_bucket_hosted_zone_id
}
failover_routing_policy
=
{
type
=
"SECONDARY"
}
}
}
]
]
...
@@ -107,6 +132,15 @@ module "disabled_records" {
...
@@ -107,6 +132,15 @@ module "disabled_records" {
# Extras - should be created in advance
# Extras - should be created in advance
#########
#########
resource
"aws_route53_health_check"
"failover"
{
fqdn
=
module
.
cloudfront
.
this_cloudfront_distribution_domain_name
port
=
443
type
=
"HTTPS"
resource_path
=
"/index.html"
failure_threshold
=
3
request_interval
=
30
}
module
"s3_bucket"
{
module
"s3_bucket"
{
source
=
"terraform-aws-modules/s3-bucket/aws"
source
=
"terraform-aws-modules/s3-bucket/aws"
...
...
modules/records/main.tf
View file @
abaab05d
...
@@ -16,11 +16,12 @@ resource "aws_route53_record" "this" {
...
@@ -16,11 +16,12 @@ resource "aws_route53_record" "this" {
zone_id
=
data
.
aws_route53_zone
.
this
[
0
]
.
zone_id
zone_id
=
data
.
aws_route53_zone
.
this
[
0
]
.
zone_id
name
=
each
.
value
.
name
!
=
""
?
"
${
each
.
value
.
name
}
.
${data
.
aws_route53_zone
.
this
[
0
].
name
}
"
:
data
.
aws_route53_zone
.
this
[
0
]
.
name
name
=
each
.
value
.
name
!
=
""
?
"
${
each
.
value
.
name
}
.
${data
.
aws_route53_zone
.
this
[
0
].
name
}
"
:
data
.
aws_route53_zone
.
this
[
0
]
.
name
type
=
each
.
value
.
type
type
=
each
.
value
.
type
ttl
=
lookup
(
each
.
value
,
"ttl"
,
null
)
ttl
=
lookup
(
each
.
value
,
"ttl"
,
null
)
records
=
lookup
(
each
.
value
,
"records"
,
null
)
records
=
lookup
(
each
.
value
,
"records"
,
null
)
set_identifier
=
lookup
(
each
.
value
,
"set_identifier"
,
null
)
set_identifier
=
lookup
(
each
.
value
,
"set_identifier"
,
null
)
health_check_id
=
lookup
(
each
.
value
,
"health_check_id"
,
null
)
dynamic
"alias"
{
dynamic
"alias"
{
for_each
=
length
(
keys
(
lookup
(
each
.
value
,
"alias"
,
{}
)))
==
0
?
[]
:
[
true
]
for_each
=
length
(
keys
(
lookup
(
each
.
value
,
"alias"
,
{}
)))
==
0
?
[]
:
[
true
]
...
@@ -32,6 +33,14 @@ resource "aws_route53_record" "this" {
...
@@ -32,6 +33,14 @@ resource "aws_route53_record" "this" {
}
}
}
}
dynamic
"failover_routing_policy"
{
for_each
=
length
(
keys
(
lookup
(
each
.
value
,
"failover_routing_policy"
,
{}
)))
==
0
?
[]
:
[
true
]
content
{
type
=
each
.
value
.
failover_routing_policy
.
type
}
}
dynamic
"weighted_routing_policy"
{
dynamic
"weighted_routing_policy"
{
for_each
=
length
(
keys
(
lookup
(
each
.
value
,
"weighted_routing_policy"
,
{}
)))
==
0
?
[]
:
[
true
]
for_each
=
length
(
keys
(
lookup
(
each
.
value
,
"weighted_routing_policy"
,
{}
)))
==
0
?
[]
:
[
true
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment