diff --git a/README.md b/README.md index 1c03a7a..3ee16b6 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,6 @@ module "my_instance" { | [private_networks](#input_private_networks) | Private networks associated with the server. | `list(string)` | `[]` | no | | [project_id](#input_project_id) | ID of the project the namespace is associated with. Ressource will be created in the project set at the provider level if null. | `string` | `null` | no | | [root_volume](#input_root_volume) | Root volume attached to the server on creation. Updates to `root_volume.size_in_gb` will be ignored after the creation of the server. | ```object({ delete_on_termination = bool size_in_gb = number volume_id = optional(string) volume_type = optional(string) })``` | `null` | no | -| [routed_ip_enabled](#input_routed_ip_enabled) | Determine if the instance will support routed ips only. Changing it to true will migrate the server and its IP to routed type. | `bool` | `true` | no | | [security_group_id](#input_security_group_id) | ID of the security group the server is attached to. | `string` | `null` | no | | [state](#input_state) | State of the server. Default to 'started'. Possible values are: 'started', 'stopped' or 'standby'. | `string` | `"started"` | no | | [tags](#input_tags) | Tags associated with the server and dedicated ip address. | `list(string)` | `[]` | no | diff --git a/ipv4.tf b/ipv4.tf index f275963..054c800 100644 --- a/ipv4.tf +++ b/ipv4.tf @@ -17,7 +17,7 @@ resource "scaleway_instance_ip" "public_ipv4" { count = var.enable_public_ipv4 ? 1 : 0 project_id = var.project_id - type = var.routed_ip_enabled ? "routed_ipv4" : "nat" + type = "routed_ipv4" zone = var.zone } diff --git a/ipv6.tf b/ipv6.tf index d5eadfc..f9f0930 100644 --- a/ipv6.tf +++ b/ipv6.tf @@ -4,7 +4,7 @@ moved { } resource "scaleway_instance_ip" "ipv6" { - count = var.enable_ipv6 && var.routed_ip_enabled ? 1 : 0 + count = var.enable_ipv6 ? 1 : 0 project_id = var.project_id type = "routed_ipv6" @@ -12,7 +12,7 @@ resource "scaleway_instance_ip" "ipv6" { } resource "scaleway_instance_ip_reverse_dns" "ipv6" { - count = var.enable_ipv6 && var.routed_ip_enabled && (var.domainname != null) ? 1 : 0 + count = var.enable_ipv6 && (var.domainname != null) ? 1 : 0 ip_id = scaleway_instance_ip.ipv6[count.index].id reverse = local.effective_fqdn @@ -22,7 +22,7 @@ resource "scaleway_instance_ip_reverse_dns" "ipv6" { resource "scaleway_domain_record" "ipv6" { count = var.domainname != null && var.enable_ipv6 && var.state != "stopped" ? 1 : 0 - 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 + data = one([for item in scaleway_instance_server.this.public_ips[*].address : item if can(regex(":", item))]) dns_zone = var.domainname name = local.effective_hostname type = "AAAA" diff --git a/main.tf b/main.tf index 7b43530..9f24d23 100644 --- a/main.tf +++ b/main.tf @@ -20,12 +20,11 @@ resource "scaleway_instance_server" "this" { } enable_dynamic_ip = var.enable_public_ipv4 - enable_ipv6 = var.routed_ip_enabled ? null : var.enable_ipv6 - routed_ip_enabled = var.routed_ip_enabled + enable_ipv6 = null ip_ids = compact(tolist([ var.enable_public_ipv4 ? scaleway_instance_ip.public_ipv4[0].id : null, - var.enable_ipv6 && var.routed_ip_enabled ? scaleway_instance_ip.ipv6[0].id : null, + var.enable_ipv6 ? scaleway_instance_ip.ipv6[0].id : null, ])) dynamic "private_network" { diff --git a/outputs.tf b/outputs.tf index c15e98c..0956459 100644 --- a/outputs.tf +++ b/outputs.tf @@ -1,11 +1,11 @@ output "ip4" { description = "IPv4 address of the intance." - value = var.enable_public_ipv4 ? (var.routed_ip_enabled ? scaleway_instance_ip.public_ipv4[0].address : scaleway_instance_server.this.public_ip) : scaleway_instance_server.this.private_ip + value = var.enable_public_ipv4 ? scaleway_instance_ip.public_ipv4[0].address : scaleway_instance_server.this.private_ip } output "ip6" { description = "IPv6 address of the instance." - value = var.enable_ipv6 && 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 + value = var.enable_ipv6 ? one([for item in scaleway_instance_server.this.public_ips[*].address : item if can(regex(":", item))]) : scaleway_instance_server.this.ipv6_address } output "name" { diff --git a/variables.tf b/variables.tf index 43fc5b9..444b469 100644 --- a/variables.tf +++ b/variables.tf @@ -73,12 +73,6 @@ variable "enable_public_ipv4" { default = false } -variable "routed_ip_enabled" { - type = bool - description = "Determine if the instance will support routed ips only. Changing it to true will migrate the server and its IP to routed type." - default = true -} - variable "private_networks" { type = list(string) description = "Private networks associated with the server."