1
0
Fork 0
forked from pub-solar/infra
pub-solar-infra-new/docs/dns.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.5 KiB
Markdown
Raw Normal View History

2023-10-28 23:37:31 +00:00
# Changing DNS entries
2023-10-29 15:11:29 +00:00
Our current DNS provider is [namecheap](https://www.namecheap.com/).
We use [Terraform](https://www.terraform.io) to declaratively manage our pub.solar DNS records.
2023-10-29 15:11:29 +00:00
### Initial setup
Skip this step if you already have a `triton` profile setup.
```
triton profile create
```
Please follow https://docs.greenbaum.cloud/en/devops/triton-cli.html for the details.
You will need to setup the following [namecheap API credentials](https://www.namecheap.com/support/api/intro),
look for "namecheap API key" in the pub.solar Keepass database.
2024-05-08 20:57:07 +00:00
```
NAMECHEAP_API_KEY
NAMECHEAP_API_USER
NAMECHEAP_USER_NAME
```
2024-05-08 20:57:07 +00:00
You will probably also need to add your external IP to the [API allow list](https://ap.www.namecheap.com/settings/tools/apiaccess/whitelisted-ips).
2024-05-08 20:57:07 +00:00
```
dig -4 ip @dns.toys
```
Now, change into the terraform directory and initialize the terraform providers.
2023-10-29 15:11:29 +00:00
```
cd terraform
export TRITON_KEY_ID=$(cat ~/.config/triton/profiles.d/lev-1-pub_solar.json | jq --raw-output .keyId)
2023-10-29 15:11:29 +00:00
terraform init
```
Make your changes, e.g. in `dns.tf`.
2024-05-08 20:57:07 +00:00
```
$EDITOR dns.tf
```
2023-10-29 15:11:29 +00:00
Plan your changes using:
2024-05-08 20:57:07 +00:00
2023-10-29 15:11:29 +00:00
```
terraform plan -out pub-solar-infra.plan
```
After verification, apply your changes with:
2024-05-08 20:57:07 +00:00
2023-10-29 15:11:29 +00:00
```
terraform apply "pub-solar-infra.plan"
```
### Useful links
We use the Manta remote backend to save the terraform state for collaboration.
2024-05-08 20:57:07 +00:00
- https://www.terraform.io/language/v1.2.x/settings/backends/manta
Namecheap Terraform provider docs:
2024-05-08 20:57:07 +00:00
- https://registry.terraform.io/providers/namecheap/namecheap/latest/docs