mirror of
https://github.com/phfroidmont/self-hosting.git
synced 2025-12-25 05:36:59 +01:00
Update Terraform files to 0.12 syntax
This commit is contained in:
parent
1b990d8c0e
commit
6ad25c79f6
3 changed files with 33 additions and 27 deletions
|
|
@ -1,55 +1,56 @@
|
|||
locals {
|
||||
environment = "${terraform.workspace != "" ? terraform.workspace : "test"}"
|
||||
environment = terraform.workspace != "" ? terraform.workspace : "test"
|
||||
}
|
||||
|
||||
terraform {
|
||||
backend "s3" {
|
||||
bucket = "banditlair-k8s-tfstate"
|
||||
key = "k8s.tfstate"
|
||||
key = "banditlair.tfstate"
|
||||
region = "nl-ams"
|
||||
endpoint = "https://s3.nl-ams.scw.cloud"
|
||||
profile = "default"
|
||||
skip_credentials_validation = true
|
||||
skip_region_validation = true
|
||||
}
|
||||
}
|
||||
|
||||
provider "scaleway" {
|
||||
region = "${var.region}"
|
||||
region = var.region
|
||||
}
|
||||
|
||||
data "scaleway_image" "ubuntu" {
|
||||
architecture = "${var.architecture}"
|
||||
name = "${var.image}"
|
||||
architecture = var.architecture
|
||||
name = var.image
|
||||
}
|
||||
|
||||
resource "scaleway_server" "node" {
|
||||
count = "${var.node_instance_count}"
|
||||
name = "node${count.index+1}"
|
||||
image = "${data.scaleway_image.ubuntu.id}"
|
||||
type = "${var.node_instance_type}"
|
||||
count = var.node_instance_count
|
||||
name = "node${count.index + 1}"
|
||||
image = data.scaleway_image.ubuntu.id
|
||||
type = var.node_instance_type
|
||||
state = "running"
|
||||
dynamic_ip_required = true,
|
||||
dynamic_ip_required = true
|
||||
tags = ["${local.environment}-node"]
|
||||
}
|
||||
|
||||
resource "scaleway_server" "master" {
|
||||
count = "${var.master_instance_count}"
|
||||
name = "master${count.index+1}"
|
||||
image = "${data.scaleway_image.ubuntu.id}"
|
||||
type = "${var.master_instance_type}"
|
||||
count = var.master_instance_count
|
||||
name = "master${count.index + 1}"
|
||||
image = data.scaleway_image.ubuntu.id
|
||||
type = var.master_instance_type
|
||||
state = "running"
|
||||
dynamic_ip_required = true,
|
||||
dynamic_ip_required = true
|
||||
tags = [
|
||||
"${local.environment}-master",
|
||||
"${local.environment}-etcd"
|
||||
"${local.environment}-etcd",
|
||||
]
|
||||
}
|
||||
|
||||
output "node_private_ips" {
|
||||
value = ["${scaleway_server.node.*.private_ip}"]
|
||||
value = [scaleway_server.node.*.private_ip]
|
||||
}
|
||||
|
||||
output "master_private_ips" {
|
||||
value = ["${scaleway_server.master.*.private_ip}"]
|
||||
value = [scaleway_server.master.*.private_ip]
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -25,3 +25,4 @@ variable "node_instance_type" {
|
|||
variable "node_instance_count" {
|
||||
default = 2
|
||||
}
|
||||
|
||||
|
|
|
|||
4
terraform/versions.tf
Normal file
4
terraform/versions.tf
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
|
||||
terraform {
|
||||
required_version = ">= 0.12"
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue