File tree 2 files changed +19
-0
lines changed
2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 14
14
``` console
15
15
$ terraform import digitalocean_droplet.web <id>
16
16
$ terraform import digitalocean_domain.site my-stamps.ru
17
+ $ terraform import digitalocean_record.www my-stamps.ru,<id>
18
+ $ terraform import digitalocean_record.no-www my-stamps.ru,<id>
17
19
```
20
+ The ids can be obtained by API:
21
+ - https://developers.digitalocean.com/documentation/v2/#list-all-droplets
22
+ - https://developers.digitalocean.com/documentation/v2/#list-all-domain-records
18
23
* Plan and apply:
19
24
``` console
20
25
$ terraform plan -out terraform.tfplan
Original file line number Diff line number Diff line change @@ -22,3 +22,17 @@ resource "digitalocean_droplet" "web" {
22
22
resource "digitalocean_domain" "site" {
23
23
name = " my-stamps.ru"
24
24
}
25
+
26
+ # https://www.terraform.io/docs/providers/do/r/record.html
27
+ resource "digitalocean_record" "no-www" {
28
+ domain = digitalocean_domain. site . name
29
+ type = " A"
30
+ name = " @"
31
+ value = digitalocean_droplet. web . ipv4_address
32
+ }
33
+ resource "digitalocean_record" "www" {
34
+ domain = digitalocean_domain. site . name
35
+ type = " A"
36
+ name = " www"
37
+ value = digitalocean_droplet. web . ipv4_address
38
+ }
You can’t perform that action at this time.
0 commit comments