Fix indexing of resources when looping

This commit is contained in:
Magnus Andersson 2024-01-11 16:39:19 +01:00
parent c6a5d0b608
commit bb139e7239
Signed by: mandersson
GPG key ID: 19CB2C58E1F19B16

View file

@ -11,7 +11,7 @@ resource "openstack_networking_port_v2" "kubeport" {
resource "openstack_blockstorage_volume_v3" "kubevolume" { resource "openstack_blockstorage_volume_v3" "kubevolume" {
count = var.kubesize # size of cluster count = var.kubesize # size of cluster
name = "kube${count.index}-matrix-test-sunet-se-vol" name = "kube${count.index + 1}-matrix-test-sunet-se-vol"
description = "OS volume for kubernetes node ${count.index}" description = "OS volume for kubernetes node ${count.index}"
size = 30 size = 30
image_id = data.openstack_images_image_v2.ubuntu2204image.id image_id = data.openstack_images_image_v2.ubuntu2204image.id
@ -20,7 +20,7 @@ resource "openstack_blockstorage_volume_v3" "kubevolume" {
# Create instances of kubernetes nodes # Create instances of kubernetes nodes
resource "openstack_compute_instance_v2" "kube" { resource "openstack_compute_instance_v2" "kube" {
name = "kube${count.index}.matrix-test.sunet.se" name = "kube${count.index + 1}.matrix-test.sunet.se"
count = var.kubesize count = var.kubesize
flavor_id = data.openstack_compute_flavor_v2.b2c4r16.id flavor_id = data.openstack_compute_flavor_v2.b2c4r16.id
key_pair = data.openstack_compute_keypair_v2.manderssonpub.id key_pair = data.openstack_compute_keypair_v2.manderssonpub.id