Skip to content

Commit 43c2ecf

Browse files
feat: Add options to set Project ID and Zone. (#5)
1 parent 0502b40 commit 43c2ecf

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ module "my_instance" {
5858
| <a name="input_name"></a> [name](#input_name) | Name of the server. | `string` | `null` | no |
5959
| <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 |
6060
| <a name="input_private_networks"></a> [private_networks](#input_private_networks) | Private networks associated with the server. | `list(string)` | `[]` | no |
61+
| <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 |
6162
| <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 |
6263
| <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 |
6364
| <a name="input_tags"></a> [tags](#input_tags) | Tags associated with the server and dedicated ip address. | `list(any)` | `[]` | no |
65+
| <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 |
6466
<!-- END_TF_DOCS -->
6567

6668
## Authors

main.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ moved {
55

66
resource "scaleway_instance_ip" "this" {
77
count = var.enable_public_ipv4 == true ? 1 : 0
8+
9+
project_id = var.project_id
10+
zone = var.zone
811
}
912

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

1316
ip_id = scaleway_instance_ip.this[count.index].id
1417
reverse = format("%s.%s", var.name, var.dns_zone)
18+
zone = var.zone
1519
}
1620

1721
resource "scaleway_instance_server" "this" {
@@ -41,6 +45,9 @@ resource "scaleway_instance_server" "this" {
4145
bootscript_id = var.bootscript_id
4246
state = var.state
4347
# user_data = var.user_data
48+
49+
project_id = var.project_id
50+
zone = var.zone
4451
}
4552

4653
resource "scaleway_domain_record" "ip4" {

variables.tf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ variable "enable_public_ipv4" {
6767
}
6868

6969
variable "private_networks" {
70-
type = list(string)
70+
type = list(string)
7171
description = "Private networks associated with the server."
72-
default = []
72+
default = []
7373
}
7474

7575
# Start settings
@@ -106,3 +106,16 @@ variable "state" {
106106
# 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."
107107
# default = null
108108
# }
109+
110+
# Location & Tenancy
111+
variable "project_id" {
112+
description = "ID of the project the namespace is associated with. Ressource will be created in the project set at the provider level if null."
113+
type = string
114+
default = null
115+
}
116+
117+
variable "zone" {
118+
description = "The zone in which the instance should be created. Ressource will be created in the zone set at the provider level if null."
119+
type = string
120+
default = null
121+
}

0 commit comments

Comments
 (0)