I have a terraform script that deploys a micro-service (let's call it myservice here) which contains a route53 record.
This script works ok in Tokyo region, because this region has all the AWS services required by myservice.
Now I'm going to deploy myservice into to cn-norhthwest-1, which is Ningxia region in China.
Since route53 doesn't exist in AWS China, currently my solution is to manually set the domain name of China's myservice in a normal AWS account (i.e. the AWS account that contains Tokyo, Ohio, Oregon ... regions).
For example, pointing www.myservice.com.cn
to a CNAME record of myservice-ningxia-elb-1234567890.cn-northwest-1.elb.amazonaws.com.cn
, which is an ELB's domain name in Ningxia region.
How can I automize this process with terraform?
This is my folder structure:
.
├── environments
│ ├── ningxia
│ │ ├── main.tf
│ │ └── versions.tf
│ └── tokyo
│ ├── main.tf
│ └── versions.tf
└── modules
├── cloud-init.yaml
├── outputs.tf
├── myservice.tf
└── variables.tf
I can create myservice in Tokyo region by running
cd environments && \
terraform init && \
terraform apply
This post shows that we can create aws_route53_zone
in cn-northwest-1
region using the following code
# configure AWS provider for China region.
provider "aws" {
region = "cn-northwest-1"
access_key = AK
secret_key = SK
endpoints {
route53 = "https://api.route53.cn"
}
}
# create a route 53 pub zone
resource "aws_route53_zone" "test" {
name = "bobtest3.cn"
comment = "try to create a pub zone with terraform in China region v2!"
}
How is this possible?
I can't even find route53 in AWS console in Ningxia region.