Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ module "my_instance" {
| <a name="input_name"></a> [name](#input_name) | Name of the server. | `string` | `null` | no |
| <a name="input_placement_group_id"></a> [placement_group_id](#input_placement_group_id) | ID of the placement group the server is attached to. | `string` | `null` | no |
| <a name="input_private_networks"></a> [private_networks](#input_private_networks) | Private networks associated with the server. | `list(string)` | `[]` | no |
| <a name="input_project_id"></a> [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 |
| <a name="input_security_group_id"></a> [security_group_id](#input_security_group_id) | ID of the security group the server is attached to. | `string` | `null` | no |
| <a name="input_state"></a> [state](#input_state) | State of the server. Default to 'started'. Possible values are: 'started', 'stopped' or 'standby'. | `string` | `"started"` | no |
| <a name="input_tags"></a> [tags](#input_tags) | Tags associated with the server and dedicated ip address. | `list(any)` | `[]` | no |
| <a name="input_zone"></a> [zone](#input_zone) | The zone in which the instance should be created. Ressource will be created in the zone set at the provider level if null. | `string` | `null` | no |
<!-- END_TF_DOCS -->

## Authors
Expand Down
7 changes: 7 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@ moved {

resource "scaleway_instance_ip" "this" {
count = var.enable_public_ipv4 == true ? 1 : 0

project_id = var.project_id
zone = var.zone
}

resource "scaleway_instance_ip_reverse_dns" "this" {
count = var.enable_public_ipv4 == true ? 1 : 0

ip_id = scaleway_instance_ip.this[count.index].id
reverse = format("%s.%s", var.name, var.dns_zone)
zone = var.zone
}

resource "scaleway_instance_server" "this" {
Expand Down Expand Up @@ -41,6 +45,9 @@ resource "scaleway_instance_server" "this" {
bootscript_id = var.bootscript_id
state = var.state
# user_data = var.user_data

project_id = var.project_id
zone = var.zone
}

resource "scaleway_domain_record" "ip4" {
Expand Down
17 changes: 15 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ variable "enable_public_ipv4" {
}

variable "private_networks" {
type = list(string)
type = list(string)
description = "Private networks associated with the server."
default = []
default = []
}

# Start settings
Expand Down Expand Up @@ -106,3 +106,16 @@ variable "state" {
# description = "User data associated with the server. Use the cloud-init key to use cloud-init on your instance. You can define values using:\n- string\n- UTF-8 encoded file content using file\n- Binary files using filebase64."
# default = null
# }

# Location & Tenancy
variable "project_id" {
description = "ID of the project the namespace is associated with. Ressource will be created in the project set at the provider level if null."
type = string
default = null
}

variable "zone" {
description = "The zone in which the instance should be created. Ressource will be created in the zone set at the provider level if null."
type = string
default = null
}