123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- # Copyright Materialize, Inc. and contributors. All rights reserved.
- #
- # Use of this software is governed by the Business Source License
- # included in the LICENSE file at the root of this repository.
- #
- # As of the Change Date specified in that file, in accordance with
- # the Business Source License, use of this software will be governed
- # by the Apache License, Version 2.0.
- terraform {
- required_version = ">= 1.0"
- required_providers {
- google = {
- source = "hashicorp/google"
- version = ">= 6.0"
- }
- kubernetes = {
- source = "hashicorp/kubernetes"
- version = "~> 2.0"
- }
- helm = {
- source = "hashicorp/helm"
- version = "~> 2.0"
- }
- }
- }
- provider "google" {
- project = var.project_id
- region = var.region
- }
- data "google_client_config" "default" {}
- provider "kubernetes" {
- host = "https://${module.materialize.gke_cluster.endpoint}"
- token = data.google_client_config.default.access_token
- cluster_ca_certificate = base64decode(module.materialize.gke_cluster.ca_certificate)
- }
- provider "helm" {
- kubernetes {
- host = "https://${module.materialize.gke_cluster.endpoint}"
- token = data.google_client_config.default.access_token
- cluster_ca_certificate = base64decode(module.materialize.gke_cluster.ca_certificate)
- }
- }
- module "materialize" {
- source = "github.com/MaterializeInc/terraform-google-materialize?ref=v0.4.3"
- project_id = var.project_id
- region = var.region
- prefix = "tf-gcp-test"
- database_config = {
- tier = "db-custom-2-4096"
- version = "POSTGRES_15"
- password = var.database_password
- }
- network_config = {
- subnet_cidr = "10.0.0.0/20"
- pods_cidr = "10.48.0.0/14"
- services_cidr = "10.52.0.0/20"
- }
- labels = {
- environment = "simple"
- example = "true"
- }
- install_materialize_operator = true
- use_local_chart = true
- helm_chart = "materialize-operator-v25.3.0-beta.1.tgz"
- operator_version = var.operator_version
- orchestratord_version = var.orchestratord_version
- install_cert_manager = false
- use_self_signed_cluster_issuer = false
- helm_values = {
- clusters = {
- defaultReplicationFactor = {
- system = 1
- probe = 1
- support = 1
- analytics = 1
- }
- }
- }
- providers = {
- google = google
- kubernetes = kubernetes
- helm = helm
- }
- }
- variable "project_id" {
- description = "GCP Project ID"
- type = string
- default = "materialize-ci"
- }
- variable "region" {
- description = "GCP Region"
- type = string
- default = "us-east1"
- }
- variable "database_password" {
- description = "Password for Cloud SQL database user"
- default = "your-strong-password"
- type = string
- sensitive = true
- }
- variable "operator_version" {
- type = string
- default = "v25.3.0-beta.1.tgz"
- }
- variable "orchestratord_version" {
- type = string
- default = null
- }
- output "gke_cluster" {
- description = "GKE cluster details"
- value = module.materialize.gke_cluster
- sensitive = true
- }
- output "service_accounts" {
- description = "Service account details"
- value = module.materialize.service_accounts
- }
- output "connection_strings" {
- description = "Connection strings for metadata and persistence backends"
- value = module.materialize.connection_strings
- sensitive = true
- }
|