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

fix: replace network_id with subnet_id #30

Merged
merged 2 commits into from
Aug 5, 2020
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
8 changes: 4 additions & 4 deletions examples/hcloud-k3s/agent_instances.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ resource hcloud_server agents {
}

resource hcloud_server_network agents_network {
count = length(hcloud_server.agents)
server_id = hcloud_server.agents[count.index].id
network_id = hcloud_network.k3s.id
ip = cidrhost(hcloud_network_subnet.k3s_nodes.ip_range, 1 + var.servers_num + count.index)
count = length(hcloud_server.agents)
server_id = hcloud_server.agents[count.index].id
subnet_id = hcloud_network_subnet.k3s_nodes.id
ip = cidrhost(hcloud_network_subnet.k3s_nodes.ip_range, 1 + var.servers_num + count.index)
}
9 changes: 4 additions & 5 deletions examples/hcloud-k3s/server_instances.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ resource hcloud_server control_planes {
}

resource hcloud_server_network control_planes {
count = var.servers_num

network_id = hcloud_network.k3s.id
server_id = hcloud_server.control_planes[count.index].id
ip = cidrhost(hcloud_network_subnet.k3s_nodes.ip_range, 1 + count.index)
count = var.servers_num
subnet_id = hcloud_network_subnet.k3s_nodes.id
server_id = hcloud_server.control_planes[count.index].id
ip = cidrhost(hcloud_network_subnet.k3s_nodes.ip_range, 1 + count.index)
}
2 changes: 1 addition & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ variable "depends_on_" {
}

variable k3s_version {
description = "Specify the k3s version."
description = "Specify the k3s version. You can choose from the following release channels or pin the version directly"
type = string
default = "latest"
}
Expand Down
6 changes: 3 additions & 3 deletions version.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
// Fetch the last version of k3s
data "http" "k3s_version" {
url = "https://api.github.com/repos/rancher/k3s/releases/latest"
url = "https://update.k3s.io/v1-release/channels"
}

// Fetch the k3s installation script
data "http" "k3s_installer" {
url = "https://raw.githubusercontent.com/rancher/k3s/${jsondecode(data.http.k3s_version.body).tag_name}/install.sh"
url = "https://raw.githubusercontent.com/rancher/k3s/${jsondecode(data.http.k3s_version.body).data[1].latest}/install.sh"
}

locals {
// Use the fetched version if 'lastest' is specified
k3s_version = var.k3s_version == "latest" ? jsondecode(data.http.k3s_version.body).tag_name : var.k3s_version
k3s_version = var.k3s_version == "latest" ? jsondecode(data.http.k3s_version.body).data[1].latest : var.k3s_version
}