Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCLOUD2-11417 update gcore_instancev2 docs+lbmember docs #127

Merged
merged 1 commit into from
Sep 11, 2024
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
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ resource "gcore_volume" "third_volume" {
project_id = var.project_id
}

resource "gcore_instance" "instance" {
resource "gcore_instancev2" "instance" {
flavor_id = "g1-standard-2-4"
name = "test_instance_1"
keypair_name = gcore_keypair.kp.sshkey_name
Expand Down Expand Up @@ -164,12 +164,12 @@ resource "gcore_lbmember" "lbm" {
project_id = var.project_id
region_id = var.region_id
pool_id = gcore_lbpool.pl.id
instance_id = gcore_instance.instance.id
address = tolist(gcore_instance.instance.interface).0.ip_address
instance_id = gcore_instancev2.instance.id
address = tolist(gcore_instancev2.instance.interface).0.ip_address
protocol_port = 8081
}

resource "gcore_instance" "instance2" {
resource "gcore_instancev2" "instance2" {
flavor_id = "g1-standard-2-4"
name = "test_instance_2"
keypair_name = gcore_keypair.kp.sshkey_name
Expand Down Expand Up @@ -205,8 +205,8 @@ resource "gcore_lbmember" "lbm2" {
project_id = var.project_id
region_id = var.region_id
pool_id = gcore_lbpool.pl.id
instance_id = gcore_instance.instance2.id
address = tolist(gcore_instance.instance2.interface).0.ip_address
instance_id = gcore_instancev2.instance2.id
address = tolist(gcore_instancev2.instance2.interface).0.ip_address
protocol_port = 8081
weight = 5
}
Expand Down
32 changes: 12 additions & 20 deletions docs/resources/instancev2.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ data "gcore_image" "ubuntu" {
}

resource "gcore_volume" "boot_volume" {
name = "boot volume"
name = "my-boot-volume"
type_name = "ssd_hiiops"
size = 5
image_id = data.gcore_image.ubuntu.id
Expand All @@ -81,7 +81,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand All @@ -107,7 +106,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down Expand Up @@ -139,7 +137,7 @@ data "gcore_image" "windows" {
}

resource "gcore_volume" "boot_volume_windows" {
name = "windows boot volume"
name = "my-windows-boot-volume"
type_name = "ssd_hiiops"
size = 50
image_id = data.gcore_image.windows.id
Expand Down Expand Up @@ -194,7 +192,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand All @@ -204,7 +201,6 @@ resource "gcore_instancev2" "instance" {
name = "my-floating-ip-interface"
port_id = gcore_reservedfixedip.fixed_ip.port_id

fip_source = "existing"
existing_fip_id = gcore_floatingip.floating_ip.id
}

Expand All @@ -228,7 +224,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down Expand Up @@ -305,7 +300,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand All @@ -328,8 +322,12 @@ resource "gcore_instancev2" "instance" {
This example shows how to create a Windows instance with two users. The second user is added by using
the userdata feature to automate the creation process.

userdata:
```userdata

```terraform
variable "second_user_userdata" {
description = "This is a variable of type string"
type = string
default = <<EOF
<powershell>
# Be sure to set the username and password on these two lines. Of course this is not a good
# security practice to include a password at command line.
Expand All @@ -339,17 +337,17 @@ New-LocalUser $User -Password $Password
Add-LocalGroupMember -Group "Remote Desktop Users" -Member $User
Add-LocalGroupMember -Group "Administrators" -Member $User
</powershell>
```
EOF
}

```terraform
data "gcore_image" "windows" {
name = "windows-server-2022"
region_id = data.gcore_region.region.id
project_id = data.gcore_project.project.id
}

resource "gcore_volume" "boot_volume_windows" {
name = "windows boot volume"
name = "my-windows-boot-volume"
type_name = "ssd_hiiops"
size = 50
image_id = data.gcore_image.windows.id
Expand All @@ -361,10 +359,9 @@ resource "gcore_instancev2" "instance" {
flavor_id = "g1w-standard-4-8"
name = "my-windows-instance"
password = "my-s3cR3tP@ssw0rd"
user_data = "PHBvd2Vyc2hlbGw+CiMgQmUgc3VyZSB0byBzZXQgdGhlIHVzZXJuYW1lIGFuZCBwYXNzd29yZCBvbiB0aGVzZSB0d28gbGluZXMuIE9mIGNvdXJzZSB0aGlzIGlzIG5vdCBhIGdvb2QKIyBzZWN1cml0eSBwcmFjdGljZSB0byBpbmNsdWRlIGEgcGFzc3dvcmQgYXQgY29tbWFuZCBsaW5lLgokVXNlciA9ICJTZWNvbmRVc2VyIgokUGFzc3dvcmQgPSBDb252ZXJ0VG8tU2VjdXJlU3RyaW5nICJzM2NSM3RQQHNzdzByZCIgLUFzUGxhaW5UZXh0IC1Gb3JjZQpOZXctTG9jYWxVc2VyICRVc2VyIC1QYXNzd29yZCAkUGFzc3dvcmQKQWRkLUxvY2FsR3JvdXBNZW1iZXIgLUdyb3VwICJSZW1vdGUgRGVza3RvcCBVc2VycyIgLU1lbWJlciAkVXNlcgpBZGQtTG9jYWxHcm91cE1lbWJlciAtR3JvdXAgIkFkbWluaXN0cmF0b3JzIiAtTWVtYmVyICRVc2VyCjwvcG93ZXJzaGVsbD4="
user_data = base64encode(var.second_user_userdata)

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume_windows.id
boot_index = 0
}
Expand Down Expand Up @@ -436,7 +433,6 @@ Required:
Optional:

- `existing_fip_id` (String)
- `fip_source` (String)
- `ip_address` (String)
- `network_id` (String) required if type is 'subnet' or 'any_subnet'
- `order` (Number) Order of attaching interface
Expand Down Expand Up @@ -467,10 +463,6 @@ Required:
<a id="nestedblock--volume"></a>
### Nested Schema for `volume`

Required:

- `source` (String) Currently available only 'existing-volume' value

Optional:

- `attachment_tag` (String)
Expand Down
18 changes: 0 additions & 18 deletions docs/resources/k8sv2.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ output "kubeconfig" {
- `id` (String) The ID of this resource.
- `is_public` (Boolean) True if the cluster is public.
- `security_group_id` (String) Security group ID.
- `security_group_rules_internal` (List of Object) Default readonly security group rules. It is used for internal purposes only. (see [below for nested schema](#nestedatt--security_group_rules_internal))
- `status` (String) Cluster status.
- `task_id` (String)

Expand Down Expand Up @@ -198,23 +197,6 @@ Optional:
- `create` (String)
- `update` (String)


<a id="nestedatt--security_group_rules_internal"></a>
### Nested Schema for `security_group_rules_internal`

Read-Only:

- `created_at` (String)
- `description` (String)
- `direction` (String)
- `ethertype` (String)
- `id` (String)
- `port_range_max` (Number)
- `port_range_min` (Number)
- `protocol` (String)
- `remote_ip_prefix` (String)
- `updated_at` (String)

## Import

Import is supported using the following syntax:
Expand Down
5 changes: 3 additions & 2 deletions docs/resources/lbmember.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ resource "gcore_volume" "instance_member_volume" {
}


resource "gcore_instance" "instance_member" {
resource "gcore_instancev2" "instance_member" {
project_id = data.gcore_project.project.id
region_id = data.gcore_region.region.id

Expand All @@ -189,6 +189,7 @@ resource "gcore_instance" "instance_member" {

interface {
type = "reserved_fixed_ip"
name = "my-private-network-interface"
port_id = gcore_reservedfixedip.instance_member_fixed_ip.port_id
}
}
Expand All @@ -199,7 +200,7 @@ resource "gcore_lbmember" "instance_member" {

pool_id = gcore_lbpool.http.id

instance_id = gcore_instance.instance_member.id
instance_id = gcore_instancev2.instance_member.id
address = gcore_reservedfixedip.instance_member_fixed_ip.fixed_ip_address
protocol_port = 80
weight = 1
Expand Down
12 changes: 6 additions & 6 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ resource "gcore_volume" "third_volume" {
project_id = var.project_id
}

resource "gcore_instance" "instance" {
resource "gcore_instancev2" "instance" {
flavor_id = "g1-standard-2-4"
name = "test_instance_1"
keypair_name = gcore_keypair.kp.sshkey_name
Expand Down Expand Up @@ -149,12 +149,12 @@ resource "gcore_lbmember" "lbm" {
project_id = var.project_id
region_id = var.region_id
pool_id = gcore_lbpool.pl.id
instance_id = gcore_instance.instance.id
address = tolist(gcore_instance.instance.interface).0.ip_address
instance_id = gcore_instancev2.instance.id
address = tolist(gcore_instancev2.instance.interface).0.ip_address
protocol_port = 8081
}

resource "gcore_instance" "instance2" {
resource "gcore_instancev2" "instance2" {
flavor_id = "g1-standard-2-4"
name = "test_instance_2"
keypair_name = gcore_keypair.kp.sshkey_name
Expand Down Expand Up @@ -190,8 +190,8 @@ resource "gcore_lbmember" "lbm2" {
project_id = var.project_id
region_id = var.region_id
pool_id = gcore_lbpool.pl.id
instance_id = gcore_instance.instance2.id
address = tolist(gcore_instance.instance2.interface).0.ip_address
instance_id = gcore_instancev2.instance2.id
address = tolist(gcore_instancev2.instance2.interface).0.ip_address
protocol_port = 8081
weight = 5
}
1 change: 0 additions & 1 deletion examples/resources/gcore_instancev2/custom-sg.tf
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down
2 changes: 0 additions & 2 deletions examples/resources/gcore_instancev2/fip.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand All @@ -29,7 +28,6 @@ resource "gcore_instancev2" "instance" {
name = "my-floating-ip-interface"
port_id = gcore_reservedfixedip.fixed_ip.port_id

fip_source = "existing"
existing_fip_id = gcore_floatingip.floating_ip.id
}

Expand Down
2 changes: 1 addition & 1 deletion examples/resources/gcore_instancev2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ data "gcore_image" "ubuntu" {
}

resource "gcore_volume" "boot_volume" {
name = "boot volume"
name = "my-boot-volume"
type_name = "ssd_hiiops"
size = 5
image_id = data.gcore_image.ubuntu.id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data "gcore_image" "windows" {
}

resource "gcore_volume" "boot_volume_windows" {
name = "windows boot volume"
name = "my-windows-boot-volume"
type_name = "ssd_hiiops"
size = 50
image_id = data.gcore_image.windows.id
Expand Down
1 change: 0 additions & 1 deletion examples/resources/gcore_instancev2/one-interface.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down
1 change: 0 additions & 1 deletion examples/resources/gcore_instancev2/reserved-address.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down
1 change: 0 additions & 1 deletion examples/resources/gcore_instancev2/two-interface.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ resource "gcore_instancev2" "instance" {
keypair_name = "my-keypair"

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume.id
boot_index = 0
}
Expand Down
21 changes: 18 additions & 3 deletions examples/resources/gcore_instancev2/windows-with-userdata.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,27 @@
variable "second_user_userdata" {
description = "This is a variable of type string"
type = string
default = <<EOF
<powershell>
# Be sure to set the username and password on these two lines. Of course this is not a good
# security practice to include a password at command line.
$User = "SecondUser"
$Password = ConvertTo-SecureString "s3cR3tP@ssw0rd" -AsPlainText -Force
New-LocalUser $User -Password $Password
Add-LocalGroupMember -Group "Remote Desktop Users" -Member $User
Add-LocalGroupMember -Group "Administrators" -Member $User
</powershell>
EOF
}

data "gcore_image" "windows" {
name = "windows-server-2022"
region_id = data.gcore_region.region.id
project_id = data.gcore_project.project.id
}

resource "gcore_volume" "boot_volume_windows" {
name = "windows boot volume"
name = "my-windows-boot-volume"
type_name = "ssd_hiiops"
size = 50
image_id = data.gcore_image.windows.id
Expand All @@ -17,10 +33,9 @@ resource "gcore_instancev2" "instance" {
flavor_id = "g1w-standard-4-8"
name = "my-windows-instance"
password = "my-s3cR3tP@ssw0rd"
user_data = "PHBvd2Vyc2hlbGw+CiMgQmUgc3VyZSB0byBzZXQgdGhlIHVzZXJuYW1lIGFuZCBwYXNzd29yZCBvbiB0aGVzZSB0d28gbGluZXMuIE9mIGNvdXJzZSB0aGlzIGlzIG5vdCBhIGdvb2QKIyBzZWN1cml0eSBwcmFjdGljZSB0byBpbmNsdWRlIGEgcGFzc3dvcmQgYXQgY29tbWFuZCBsaW5lLgokVXNlciA9ICJTZWNvbmRVc2VyIgokUGFzc3dvcmQgPSBDb252ZXJ0VG8tU2VjdXJlU3RyaW5nICJzM2NSM3RQQHNzdzByZCIgLUFzUGxhaW5UZXh0IC1Gb3JjZQpOZXctTG9jYWxVc2VyICRVc2VyIC1QYXNzd29yZCAkUGFzc3dvcmQKQWRkLUxvY2FsR3JvdXBNZW1iZXIgLUdyb3VwICJSZW1vdGUgRGVza3RvcCBVc2VycyIgLU1lbWJlciAkVXNlcgpBZGQtTG9jYWxHcm91cE1lbWJlciAtR3JvdXAgIkFkbWluaXN0cmF0b3JzIiAtTWVtYmVyICRVc2VyCjwvcG93ZXJzaGVsbD4="
user_data = base64encode(var.second_user_userdata)

volume {
source = "existing-volume"
volume_id = gcore_volume.boot_volume_windows.id
boot_index = 0
}
Expand Down
5 changes: 3 additions & 2 deletions examples/resources/gcore_lbmember/instance-member.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ resource "gcore_volume" "instance_member_volume" {
}


resource "gcore_instance" "instance_member" {
resource "gcore_instancev2" "instance_member" {
project_id = data.gcore_project.project.id
region_id = data.gcore_region.region.id

Expand All @@ -58,6 +58,7 @@ resource "gcore_instance" "instance_member" {

interface {
type = "reserved_fixed_ip"
name = "my-private-network-interface"
port_id = gcore_reservedfixedip.instance_member_fixed_ip.port_id
}
}
Expand All @@ -68,7 +69,7 @@ resource "gcore_lbmember" "instance_member" {

pool_id = gcore_lbpool.http.id

instance_id = gcore_instance.instance_member.id
instance_id = gcore_instancev2.instance_member.id
address = gcore_reservedfixedip.instance_member_fixed_ip.fixed_ip_address
protocol_port = 80
weight = 1
Expand Down
Loading
Loading