Skip to content

Commit

Permalink
fix: updates for tflint and dev-tools v1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Jun 21, 2023
1 parent a0c5f3a commit 53b7617
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# Make will use bash instead of sh
SHELL := /usr/bin/env bash -O extglob

DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.0
DOCKER_TAG_VERSION_DEVELOPER_TOOLS := 1.13
DOCKER_IMAGE_DEVELOPER_TOOLS := cft/developer-tools
REGISTRY_URL := gcr.io/cloud-foundation-cicd

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Setting it to `never` will *never* gcloud download and setting it to `always` wi

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_components | Additional gcloud CLI components to install. Defaults to none. Valid value are components listed in `gcloud components list` | `list` | `[]` | no |
| additional\_components | Additional gcloud CLI components to install. Defaults to none. Valid value are components listed in `gcloud components list` | `list(string)` | `[]` | no |
| create\_cmd\_body | On create, the command body you'd like to run with your entrypoint. | `string` | `"info"` | no |
| create\_cmd\_entrypoint | On create, the command entrypoint you'd like to use. Can also be set to a custom script. Module's bin directory will be prepended to path. | `string` | `"gcloud"` | no |
| create\_cmd\_triggers | List of any additional triggers to re-run the create command execution when either of values in the maps change. Some keys are reserved and will be overwritten if specified in this option. (eg. `md5`, `arguments`, `download_gcloud_command`, `download_jq_command`, etc. See details in [the source](https://github.com/terraform-google-modules/terraform-google-gcloud/blob/master/main.tf).) | `map(any)` | `{}` | no |
Expand Down
2 changes: 1 addition & 1 deletion build/int.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ tags:
- 'integration'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.13'
2 changes: 1 addition & 1 deletion build/lint.cloudbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ tags:
- 'lint'
substitutions:
_DOCKER_IMAGE_DEVELOPER_TOOLS: 'cft/developer-tools'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.0'
_DOCKER_TAG_VERSION_DEVELOPER_TOOLS: '1.13'
17 changes: 8 additions & 9 deletions examples/kubectl_wrapper_example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module "enabled_google_apis" {

module "gcp-network" {
source = "terraform-google-modules/network/google"
version = "~> 6.0"
version = "~> 7.0"
project_id = module.enabled_google_apis.project_id
network_name = var.network

Expand All @@ -48,7 +48,7 @@ module "gcp-network" {
]

secondary_ranges = {
"${var.subnetwork}" = [
(var.subnetwork) = [
{
range_name = var.ip_range_pods_name
ip_cidr_range = "192.168.0.0/18"
Expand All @@ -63,7 +63,7 @@ module "gcp-network" {

module "gke" {
source = "terraform-google-modules/kubernetes-engine/google"
version = "~> 24.0"
version = "~> 26.0"
project_id = module.enabled_google_apis.project_id
name = var.cluster_name
regional = true
Expand All @@ -81,12 +81,11 @@ data "google_client_config" "default" {
module "kubectl-imperative" {
source = "../../modules/kubectl-wrapper"

project_id = var.project_id
cluster_name = module.gke.name
cluster_location = module.gke.location
module_depends_on = [module.gke.endpoint]
# using --generator for cross compat between 1.18 and lower
kubectl_create_command = "kubectl run --generator=run-pod/v1 nginx-imperative --image=nginx"
project_id = var.project_id
cluster_name = module.gke.name
cluster_location = module.gke.location
module_depends_on = [module.gke.endpoint]
kubectl_create_command = "kubectl run nginx-imperative --image=nginx"
kubectl_destroy_command = "kubectl delete pod nginx-imperative"
skip_download = true
}
Expand Down
2 changes: 1 addition & 1 deletion modules/kubectl-wrapper/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module "kubectl" {

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| additional\_components | Additional gcloud CLI components to install. Defaults to installing kubectl. Valid value are components listed in `gcloud components list` | `list` | <pre>[<br> "kubectl"<br>]</pre> | no |
| additional\_components | Additional gcloud CLI components to install. Defaults to installing kubectl. Valid value are components listed in `gcloud components list` | `list(string)` | <pre>[<br> "kubectl"<br>]</pre> | no |
| cluster\_location | Cluster location (Zone/Region). Optional if use\_existing\_context is true. | `string` | `""` | no |
| cluster\_name | Cluster name. Optional if use\_existing\_context is true. | `string` | `""` | no |
| create\_cmd\_triggers | List of any additional triggers for the create command execution. | `map(any)` | `{}` | no |
Expand Down
6 changes: 5 additions & 1 deletion modules/kubectl-wrapper/variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2020 Google LLC
* Copyright 2020-2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -62,6 +62,7 @@ variable "create_cmd_triggers" {

variable "additional_components" {
description = "Additional gcloud CLI components to install. Defaults to installing kubectl. Valid value are components listed in `gcloud components list`"
type = list(string)
default = ["kubectl"]
}

Expand All @@ -73,6 +74,7 @@ variable "skip_download" {

variable "gcloud_sdk_version" {
description = "The gcloud sdk version to download."
type = string
default = "281.0.0"
}

Expand All @@ -96,11 +98,13 @@ variable "internal_ip" {

variable "service_account_key_file" {
description = "Path to service account key file to auth as for running `gcloud container clusters get-credentials`."
type = string
default = ""
}

variable "use_tf_google_credentials_env_var" {
description = "Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional."
type = bool
default = false
}

Expand Down
12 changes: 11 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright 2018 Google LLC
* Copyright 2018-2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,11 +40,13 @@ variable "module_depends_on" {

variable "create_cmd_entrypoint" {
description = "On create, the command entrypoint you'd like to use. Can also be set to a custom script. Module's bin directory will be prepended to path."
type = string
default = "gcloud"
}

variable "create_cmd_body" {
description = "On create, the command body you'd like to run with your entrypoint."
type = string
default = "info"
}

Expand All @@ -56,41 +58,49 @@ variable "create_cmd_triggers" {

variable "destroy_cmd_entrypoint" {
description = "On destroy, the command entrypoint you'd like to use. Can also be set to a custom script. Module's bin directory will be prepended to path."
type = string
default = "gcloud"
}

variable "destroy_cmd_body" {
description = "On destroy, the command body you'd like to run with your entrypoint."
type = string
default = "info"
}

variable "additional_components" {
description = "Additional gcloud CLI components to install. Defaults to none. Valid value are components listed in `gcloud components list`"
type = list(string)
default = []
}

variable "platform" {
description = "Platform CLI will run on. Defaults to linux. Valid values: linux, darwin"
type = string
default = "linux"
}

variable "service_account_key_file" {
description = "Path to service account key file to run `gcloud auth activate-service-account` with. Optional."
type = string
default = ""
}

variable "use_tf_google_credentials_env_var" {
description = "Use `GOOGLE_CREDENTIALS` environment variable to run `gcloud auth activate-service-account` with. Optional."
type = bool
default = false
}

variable "jq_version" {
description = "The jq version to download."
type = string
default = "1.6"
}

variable "gcloud_sdk_version" {
description = "The gcloud sdk version to download."
type = string
default = "281.0.0"
}

Expand Down
8 changes: 8 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ terraform {
source = "hashicorp/external"
version = ">= 2.2.2"
}
random = {
source = "hashicorp/random"
version = ">= 2.1.0"
}
null = {
source = "hashicorp/null"
version = ">= 2.1.0"
}
}

provider_meta "google" {
Expand Down

0 comments on commit 53b7617

Please sign in to comment.