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

Upgraded Terraform to >=1.0 #2308

Merged
merged 7 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 1 addition & 1 deletion build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ RUN echo "export PATH=/usr/local/go/bin:/go/bin/:\$PATH" >> /root/.bashrc
RUN echo "export EDITOR=nano" >> /root/.bashrc

# install terraform
RUN wget -nv -O terraform.zip https://releases.hashicorp.com/terraform/0.12.21/terraform_0.12.21_linux_amd64.zip && unzip ./terraform.zip && mv terraform /usr/local/bin/
RUN wget -nv -O terraform.zip https://releases.hashicorp.com/terraform/1.0.8/terraform_1.0.8_linux_amd64.zip && unzip ./terraform.zip && mv terraform /usr/local/bin/

# code generation scripts
COPY *.sh /root/
Expand Down
16 changes: 12 additions & 4 deletions build/terraform/e2e/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,18 @@
// Run:
// terraform apply -var project="<YOUR_GCP_ProjectID>"

provider "google" {
version = "~> 2.10"
terraform {
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.88"
}
helm = {
source = "hashicorp/helm"
version = "~> 2.3"
}
}
}

variable "project" {
Expand All @@ -39,9 +49,7 @@ module "gke_cluster" {
}

provider "helm" {
version = "~> 1.2"
kubernetes {
load_config_file = false
roberthbailey marked this conversation as resolved.
Show resolved Hide resolved
host = module.gke_cluster.host
token = module.gke_cluster.token
cluster_ca_certificate = module.gke_cluster.cluster_ca_certificate
Expand Down
19 changes: 11 additions & 8 deletions build/terraform/gke/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@


// Run:
// terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.4.0"]

provider "google" {
version = "~> 2.10"
}

provider "google-beta" {
version = "~> 2.10"
// terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.17.0"]

terraform {
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.88"
}
}
}

variable "project" {
Expand Down Expand Up @@ -142,6 +144,7 @@ output "host" {
}
output "token" {
value = module.gke_cluster.token
sensitive = true
}
output "cluster_ca_certificate" {
value = module.gke_cluster.cluster_ca_certificate
Expand Down
10 changes: 8 additions & 2 deletions build/terraform/prow/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

provider "google" {
version = "~> 2.10"
terraform {
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
google = {
source = "google"
version = "~> 3.88"
}
}
}

variable "project" {
Expand Down
12 changes: 10 additions & 2 deletions examples/terraform-submodules/aks/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@


// Run:
// terraform apply [-var agones_version="1.3.0"]
// terraform apply [-var agones_version="1.17.0"]

terraform {
required_version = ">= 0.12.26"
required_version = ">= 1.0.0"
}

// Install latest version of agones
Expand Down Expand Up @@ -66,6 +66,10 @@ variable "resource_group_name" {
}

module "aks_cluster" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/aks/?ref=main"

client_id = var.client_id
Expand All @@ -79,6 +83,10 @@ module "aks_cluster" {
}

module "helm_agones" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=main"

agones_version = var.agones_version
Expand Down
23 changes: 20 additions & 3 deletions examples/terraform-submodules/eks/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,17 @@


// Run:
// terraform apply [-var agones_version="1.4.0"]
// terraform apply [-var agones_version="1.17.0"]

terraform {
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

// Install latest version of agones
variable "agones_version" {
Expand All @@ -34,8 +44,7 @@ variable "node_count" {
}

provider "aws" {
version = "~> 2.8"
region = var.region
region = var.region
}

variable "machine_type" { default = "t2.large" }
Expand All @@ -49,6 +58,10 @@ variable "feature_gates" {
}

module "eks_cluster" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/eks/?ref=main"

machine_type = var.machine_type
Expand All @@ -64,6 +77,10 @@ data "aws_eks_cluster_auth" "example" {
// Next Helm module cause "terraform destroy" timeout, unless helm release would be deleted first.
// Therefore "helm delete --purge agones" should be executed from the CLI before executing "terraform destroy".
module "helm_agones" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=main"

udp_expose = "false"
Expand Down
29 changes: 16 additions & 13 deletions examples/terraform-submodules/gke/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@


// Run:
// terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.8.0"]

provider "google" {
version = "~> 2.10"
}

provider "google-beta" {
version = "~> 2.10"
// terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.17.0"]

terraform {
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.88"
}
}
}

variable "project" {
Expand Down Expand Up @@ -79,8 +81,8 @@ variable "windows_machine_type" {

module "gke_cluster" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.8.0 corresponds
// to Agones version 1.8.0
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/gke/?ref=main"

Expand All @@ -99,8 +101,8 @@ module "gke_cluster" {

module "helm_agones" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.8.0 corresponds
// to Agones version 1.8.0
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.17.0 corresponds
// to Agones version 1.17.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=main"

Expand All @@ -117,7 +119,8 @@ output "host" {
value = module.gke_cluster.host
}
output "token" {
value = module.gke_cluster.token
value = module.gke_cluster.token
sensitive = true
}
output "cluster_ca_certificate" {
value = module.gke_cluster.cluster_ca_certificate
Expand Down
2 changes: 1 addition & 1 deletion install/terraform/modules/aks/aks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@


terraform {
required_version = ">= 1.0.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "~> 2.66"
}
}
required_version = ">= 0.12.26"
}

provider "azurerm" {
Expand Down
11 changes: 8 additions & 3 deletions install/terraform/modules/eks/eks.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,16 @@


terraform {
required_version = ">= 0.12.6"
required_version = ">= 1.0.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: This line has extra whitespace at the end.

required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
}
}

provider "aws" {
version = ">= 2.55.0"
region = var.region
}

Expand Down Expand Up @@ -58,7 +63,7 @@ resource "aws_security_group" "worker_group_mgmt_one" {

module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "2.47.0"
version = "~> 3.0"

name = "test-vpc-lt"
cidr = "10.0.0.0/16"
Expand Down
2 changes: 1 addition & 1 deletion install/terraform/modules/gke/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@


terraform {
required_version = ">= 0.12.6"
required_version = ">= 1.0.0"
}

data "google_client_config" "default" {}
Expand Down
8 changes: 4 additions & 4 deletions install/terraform/modules/helm3/helm.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
# This is a Helm 3.x module, and is the module that should be actively used.
#
terraform {
required_version = ">= 0.12.6"
required_version = ">= 1.0.0"
required_providers {
helm = {
version = "~> 1.2"
version = "~> 2.3"
source = "hashicorp/helm"
}
}
}

provider "helm" {
kubernetes {
load_config_file = false
host = var.host
token = var.token
cluster_ca_certificate = var.cluster_ca_certificate
Expand All @@ -43,7 +43,7 @@ resource "helm_release" "agones" {
namespace = "agones-system"
create_namespace = true

# Use terraform of the latest >=0.12 version
# Use terraform of the latest >=1.0.0 version
values = [
length(var.values_file) == 0 ? "" : file(var.values_file),
]
Expand Down