|
1 | | -moved { |
2 | | - from = scaleway_instance_ip.this |
3 | | - to = scaleway_instance_ip.public_ipv4 |
4 | | -} |
5 | | - |
6 | | -moved { |
7 | | - from = scaleway_instance_ip_reverse_dns.this |
8 | | - to = scaleway_instance_ip_reverse_dns.public_ipv4 |
9 | | -} |
10 | | - |
11 | | -moved { |
12 | | - from = scaleway_domain_record.ip4 |
13 | | - to = scaleway_domain_record.ipv4 |
14 | | -} |
15 | | - |
16 | | -moved { |
17 | | - from = scaleway_domain_record.ip6 |
18 | | - to = scaleway_domain_record.ipv6 |
19 | | -} |
20 | | - |
21 | | -locals { |
22 | | - requested_fqdn = (var.hostname != null && var.domainname != null) ? format("%s.%s", var.hostname, var.domainname) : var.hostname |
23 | | - effective_hostname = var.domainname != null ? trimsuffix(trimsuffix(scaleway_instance_server.this.name, var.domainname), ".") : scaleway_instance_server.this.name |
24 | | - effective_fqdn = var.domainname != null ? format("%s.%s", local.effective_hostname, var.domainname) : local.effective_hostname |
25 | | -} |
26 | | - |
27 | | -resource "scaleway_instance_ip" "public_ipv4" { |
28 | | - count = var.enable_public_ipv4 ? 1 : 0 |
29 | | - |
30 | | - project_id = var.project_id |
31 | | - type = var.routed_ip_enabled ? "routed_ipv4" : "nat" |
32 | | - zone = var.zone |
33 | | -} |
34 | | - |
35 | | -resource "scaleway_instance_ip_reverse_dns" "public_ipv4" { |
36 | | - count = var.enable_public_ipv4 && (var.domainname != null) ? 1 : 0 |
37 | | - |
38 | | - ip_id = scaleway_instance_ip.public_ipv4[count.index].id |
39 | | - reverse = local.effective_fqdn |
40 | | - zone = var.zone |
41 | | -} |
42 | | - |
43 | | -resource "scaleway_instance_ip" "ipv6" { |
44 | | - count = var.enable_ipv6 && var.routed_ip_enabled ? 1 : 0 |
45 | | - |
46 | | - project_id = var.project_id |
47 | | - type = "routed_ipv6" |
48 | | - zone = var.zone |
49 | | -} |
50 | | - |
51 | | -resource "scaleway_instance_ip_reverse_dns" "ipv6" { |
52 | | - count = var.enable_ipv6 && var.routed_ip_enabled && (var.domainname != null) ? 1 : 0 |
53 | | - |
54 | | - ip_id = scaleway_instance_ip.ipv6[count.index].id |
55 | | - reverse = local.effective_fqdn |
56 | | - zone = var.zone |
57 | | -} |
58 | | - |
59 | 1 | resource "scaleway_instance_server" "this" { |
60 | 2 | image = var.image |
61 | 3 | type = var.instance_type |
@@ -101,21 +43,3 @@ resource "scaleway_instance_server" "this" { |
101 | 43 | project_id = var.project_id |
102 | 44 | zone = var.zone |
103 | 45 | } |
104 | | - |
105 | | -resource "scaleway_domain_record" "ipv4" { |
106 | | - count = var.domainname != null ? 1 : 0 |
107 | | - |
108 | | - data = var.enable_public_ipv4 ? scaleway_instance_server.this.public_ip : scaleway_instance_server.this.private_ip |
109 | | - dns_zone = var.domainname |
110 | | - name = local.effective_hostname |
111 | | - type = "A" |
112 | | -} |
113 | | - |
114 | | -resource "scaleway_domain_record" "ipv6" { |
115 | | - count = var.domainname != null && var.enable_ipv6 && var.state != "stopped" ? 1 : 0 |
116 | | - |
117 | | - data = var.routed_ip_enabled ? one([for item in scaleway_instance_server.this.public_ips[*].address : item if can(regex(":", item))]) : scaleway_instance_server.this.ipv6_address |
118 | | - dns_zone = var.domainname |
119 | | - name = local.effective_hostname |
120 | | - type = "AAAA" |
121 | | -} |
0 commit comments