Skip to content

Commit

Permalink
style: use terraform fmt to match standard style
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgamache committed Jan 25, 2024
1 parent 6a06feb commit 2941761
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
22 changes: 10 additions & 12 deletions chart/cas-cif/terraform/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# Terraform workspace configuration. To apply changes to this file, use `make create_workspace`

terraform {
required_version = ">=1.4.6"

Expand All @@ -9,30 +7,30 @@ terraform {
version = "~> 2.23"
}
google = {
source = "hashicorp/google"
source = "hashicorp/google"
version = "~> 5.2.0"
}
}

backend "gcs" {}
backend "gcs" {}
}

# Configure OCP infrastructure to setup the host and authentication token
provider "kubernetes" {
host = var.kubernetes_host
token = var.kubernetes_token
host = var.kubernetes_host
token = var.kubernetes_token
}

# Configure GCP infrastructure to setup the credentials, default project and location (zone and/or region) for your resources
provider "google" {
project = var.project_id
region = local.region
project = var.project_id
region = local.region
}

# Create GCS buckets
resource "google_storage_bucket" "bucket" {
for_each = { for v in var.apps : v => v }
name = "${var.openshift_namespace}-${each.value}"
name = "${var.openshift_namespace}-${each.value}"
location = local.region
}

Expand Down Expand Up @@ -86,15 +84,15 @@ resource "kubernetes_secret" "secret_sa" {
for_each = { for v in var.apps : v => v }
metadata {
name = "gcp-${var.openshift_namespace}-${each.value}-service-account-key"
namespace = "${var.openshift_namespace}"
namespace = var.openshift_namespace
labels = {
created-by = "Terraform"
}
}

data = {
"bucket_name" = "${var.openshift_namespace}-${each.value}"
"credentials.json" = base64decode(google_service_account_key.key[each.key].private_key)
"bucket_name" = "${var.openshift_namespace}-${each.value}"
"credentials.json" = base64decode(google_service_account_key.key[each.key].private_key)
"viewer_credentials.json" = base64decode(google_service_account_key.viewer_key[each.key].private_key)
}
}
8 changes: 4 additions & 4 deletions chart/cas-cif/terraform/migration.example.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Required paramaters
project_id = "id_to_google_project_where_storage_buckets_are_held"
kubernetes_host = "https://domain.address.of.kubernetes.host:9999"
kubernetes_token = "sha256~auth_token_for_terraform_to_work_with_kubernetes"
project_id = "id_to_google_project_where_storage_buckets_are_held"
kubernetes_host = "https://domain.address.of.kubernetes.host:9999"
kubernetes_token = "sha256~auth_token_for_terraform_to_work_with_kubernetes"
openshift_namespace = "a1b2c3-dev"
apps = ["subproject_names", "for_namespace_applications"]
apps = ["subproject_names", "for_namespace_applications"]
14 changes: 4 additions & 10 deletions chart/cas-cif/terraform/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,18 @@ variable "kubernetes_token" {
description = "The authentication token of the OCP cluster"
}

# # TODO: Remove legacy (from cas-shelf) vars
# variable "namespace_apps" {
# type = list(string)
# description = "The list of namespace and app name pairs of the OCP project"
# }

variable "apps" {
type = list(string)
type = list(string)
description = "The list of app names for the OCP project in a namespace"
}

variable "openshift_namespace" {
type = string
type = string
description = "The OCP project namespace"
}

variable "iam_storage_role_template_id" {
type = string
type = string
description = "ID for a custom IAM role template we manually created in GCP for Storage Viewers"
default = "casStorageViewer"
default = "casStorageViewer"
}

0 comments on commit 2941761

Please sign in to comment.