Skip to content

Commit

Permalink
Add Terraform v0.13 input variable validations
Browse files Browse the repository at this point in the history
* Support for migrating from Terraform v0.12.x to v0.13.x
was added in v1.18.8
* Require Terraform v0.13+. Drop support for Terraform v0.12
  • Loading branch information
dghubble committed Nov 17, 2020
1 parent 5c3b5a2 commit 17b9f88
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 18 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Notable changes between versions.

## Latest

* Add input variable validations
* Require Terraform v0.13+ ([migration guide](https://typhoon.psdn.io/topics/maintenance/#terraform-versions))

## v1.19.4

* Kubernetes [v1.19.4](https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.19.md#v1194)
Expand Down
12 changes: 11 additions & 1 deletion aws/fedora-coreos/kubernetes/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,13 @@ variable "worker_type" {

variable "os_stream" {
type = string
description = "Fedora CoreOs image stream for instances (e.g. stable, testing, next)"
description = "Fedora CoreOS image stream for instances (e.g. stable, testing, next)"
default = "stable"

validation {
condition = contains(["stable", "testing", "next"], var.os_stream)
error_message = "The os_stream must be stable, testing, or next."
}
}

variable "disk_size" {
Expand Down Expand Up @@ -159,6 +164,11 @@ variable "arch" {
type = string
description = "Container architecture (amd64 or arm64)"
default = "amd64"

validation {
condition = var.arch == "amd64" || var.arch == "arm64"
error_message = "The arch must be amd64 or arm64."
}
}

variable "daemonset_tolerations" {
Expand Down
2 changes: 1 addition & 1 deletion aws/fedora-coreos/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
aws = ">= 2.23, <= 4.0"
template = "~> 2.1"
Expand Down
12 changes: 11 additions & 1 deletion aws/fedora-coreos/kubernetes/workers/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ variable "instance_type" {

variable "os_stream" {
type = string
description = "Fedora CoreOs image stream for instances (e.g. stable, testing, next)"
description = "Fedora CoreOS image stream for instances (e.g. stable, testing, next)"
default = "stable"

validation {
condition = contains(["stable", "testing", "next"], var.os_stream)
error_message = "The os_stream must be stable, testing, or next."
}
}

variable "disk_size" {
Expand Down Expand Up @@ -121,4 +126,9 @@ variable "arch" {
type = string
description = "Container architecture (amd64 or arm64)"
default = "amd64"

validation {
condition = var.arch == "amd64" || var.arch == "arm64"
error_message = "The arch must be amd64 or arm64."
}
}
2 changes: 1 addition & 1 deletion aws/fedora-coreos/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
aws = ">= 2.23, <= 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion aws/flatcar-linux/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
aws = ">= 2.23, <= 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion aws/flatcar-linux/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
aws = ">= 2.23, <= 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion azure/fedora-coreos/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
azurerm = "~> 2.8"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion azure/fedora-coreos/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
azurerm = "~> 2.8"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion azure/flatcar-linux/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
azurerm = "~> 2.8"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion azure/flatcar-linux/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
azurerm = "~> 2.8"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion bare-metal/fedora-coreos/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
template = "~> 2.1"
null = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion bare-metal/flatcar-linux/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
template = "~> 2.1"
null = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion digital-ocean/fedora-coreos/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
template = "~> 2.1"
null = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion digital-ocean/flatcar-linux/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
template = "~> 2.1"
null = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud/fedora-coreos/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
google = ">= 2.19, < 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud/fedora-coreos/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
google = ">= 2.19, < 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud/flatcar-linux/kubernetes/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
google = ">= 2.19, < 4.0"
template = "~> 2.1"
Expand Down
2 changes: 1 addition & 1 deletion google-cloud/flatcar-linux/kubernetes/workers/versions.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Terraform version and plugin versions

terraform {
required_version = ">= 0.12.26, < 0.14.0"
required_version = "~> 0.13.0"
required_providers {
google = ">= 2.19, < 4.0"
template = "~> 2.1"
Expand Down

0 comments on commit 17b9f88

Please sign in to comment.