Added structure/WIP for next modules
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
bt-autoscaler/.terraform/
|
||||
esoteric-parsec*json
|
||||
*.tfstate*
|
||||
bt-autoscaler/terraform/roots/psql/.terraform/
|
||||
*terraform-provider*
|
||||
*.deb
|
||||
|
||||
@@ -5,4 +5,4 @@ Repository for QSEoW Orchestration
|
||||
- Needs to be moved to appropriate folder, created at root by accident.
|
||||
- Initial Goal is to collate disparate efforts.
|
||||
- Componentize orchestration functions.
|
||||
- Build framework for sustainable customer solution for orchestration of QSEoW Clusters
|
||||
- Build framework for sustainable customer solution for orchestration of QSEoW Clusters
|
||||
|
||||
30
bt-autoscaler/terraform/roots/ad/main.tf
Normal file
30
bt-autoscaler/terraform/roots/ad/main.tf
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
provider "google-beta" {
|
||||
credentials = file("esoteric-parsec-243510-a8f93bb5a906.json")
|
||||
project = var.project_id
|
||||
region = var.region
|
||||
zone = var.zone
|
||||
}
|
||||
resource "google_filestore_instance" "instance" {
|
||||
provider = google-beta
|
||||
name = "qseow-files"
|
||||
zone = var.zone
|
||||
tier = var.file_tier
|
||||
project = var.project_id
|
||||
|
||||
file_shares {
|
||||
capacity_gb = 1024
|
||||
name = "qlikshare"
|
||||
|
||||
nfs_export_options {
|
||||
ip_ranges = ["10.0.0.0/24"]
|
||||
access_mode = "READ_WRITE"
|
||||
squash_mode = "NO_ROOT_SQUASH"
|
||||
}
|
||||
}
|
||||
|
||||
networks {
|
||||
network = "default"
|
||||
modes = ["MODE_IPV4"]
|
||||
}
|
||||
}
|
||||
9
bt-autoscaler/terraform/roots/ad/outputs.tf
Normal file
9
bt-autoscaler/terraform/roots/ad/outputs.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
# Configure return values from google_sql_database_instance
|
||||
|
||||
output "psql_ip_address" {
|
||||
value = google_sql_database_instance.qseow-psql.private_ip_address
|
||||
}
|
||||
|
||||
output "psql_instance_name" {
|
||||
value = google_sql_database_instance.qseow-psql.connection_name
|
||||
}
|
||||
98
bt-autoscaler/terraform/roots/ad/variables.tf
Normal file
98
bt-autoscaler/terraform/roots/ad/variables.tf
Normal file
@@ -0,0 +1,98 @@
|
||||
variable "project_id" {
|
||||
type = string
|
||||
description = "The project ID to manage the Cloud SQL resources"
|
||||
}
|
||||
|
||||
variable "database_version" {
|
||||
description = "The database version to use"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
description = "GCP Region"
|
||||
default = "us-central1"
|
||||
}
|
||||
|
||||
variable "db_tier" {
|
||||
description = "The tier for the primary SQL instance."
|
||||
type = string
|
||||
default = "db-f1-micro"
|
||||
}
|
||||
|
||||
variable "file_tier" {
|
||||
description = "The tier for the Filestore instance."
|
||||
type = string
|
||||
default = "BASIC_HDD"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "Zone target"
|
||||
}
|
||||
|
||||
variable "availability_type" {
|
||||
description = "The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`."
|
||||
type = string
|
||||
default = "REGIONAL"
|
||||
}
|
||||
|
||||
variable "backup_configuration" {
|
||||
description = "The backup_configuration settings subblock for the database setings"
|
||||
type = object({
|
||||
enabled = bool
|
||||
start_time = string
|
||||
location = string
|
||||
})
|
||||
default = {
|
||||
enabled = false
|
||||
start_time = null
|
||||
location = null
|
||||
}
|
||||
}
|
||||
|
||||
# variable "authorized_networks_a" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "71.164.77.198/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_b" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_c" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
variable "private_network" {
|
||||
description = "Full path to private network ID"
|
||||
type = string
|
||||
default = "projects/esoteric-parsec-243510/global/networks/private-network"
|
||||
}
|
||||
|
||||
variable "user_name" {
|
||||
description = "The name of the default user"
|
||||
type = string
|
||||
default = "default"
|
||||
}
|
||||
|
||||
variable "user_password" {
|
||||
description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "additional_users" {
|
||||
description = "A list of users to be created in your cluster"
|
||||
type = list(object({
|
||||
name = string
|
||||
password = string
|
||||
}))
|
||||
default = []
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"registry.terraform.io/hashicorp/google-beta": {
|
||||
"hash": "h1:zsIZIszrwu9B9TGiUMGUF3QrpOT6OxGrTIJIo+b8Re0=",
|
||||
"version": "3.41.0"
|
||||
}
|
||||
}
|
||||
30
bt-autoscaler/terraform/roots/file/main.tf
Normal file
30
bt-autoscaler/terraform/roots/file/main.tf
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
provider "google-beta" {
|
||||
credentials = file("esoteric-parsec-243510-a8f93bb5a906.json")
|
||||
project = var.project_id
|
||||
region = var.region
|
||||
zone = var.zone
|
||||
}
|
||||
resource "google_filestore_instance" "instance" {
|
||||
provider = google-beta
|
||||
name = "qseow-files"
|
||||
zone = var.zone
|
||||
tier = var.file_tier
|
||||
project = var.project_id
|
||||
|
||||
file_shares {
|
||||
capacity_gb = 1024
|
||||
name = "qlikshare"
|
||||
|
||||
nfs_export_options {
|
||||
ip_ranges = ["10.0.0.0/24"]
|
||||
access_mode = "READ_WRITE"
|
||||
squash_mode = "NO_ROOT_SQUASH"
|
||||
}
|
||||
}
|
||||
|
||||
networks {
|
||||
network = "default"
|
||||
modes = ["MODE_IPV4"]
|
||||
}
|
||||
}
|
||||
9
bt-autoscaler/terraform/roots/file/outputs.tf
Normal file
9
bt-autoscaler/terraform/roots/file/outputs.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
# Configure return values from google_sql_database_instance
|
||||
|
||||
output "psql_ip_address" {
|
||||
value = google_sql_database_instance.qseow-psql.private_ip_address
|
||||
}
|
||||
|
||||
output "psql_instance_name" {
|
||||
value = google_sql_database_instance.qseow-psql.connection_name
|
||||
}
|
||||
12
bt-autoscaler/terraform/roots/file/terraform.tfvars.json
Normal file
12
bt-autoscaler/terraform/roots/file/terraform.tfvars.json
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"project_id": "esoteric-parsec-243510",
|
||||
"region": "europe-west1",
|
||||
"zone": "europe-west1-d",
|
||||
"private_network": "projects/esoteric-parsec-243510/global/networks/default",
|
||||
"database_version": "POSTGRES_9_6",
|
||||
"db_tier": "db-g1-small",
|
||||
"file_tier": "BASIC_HDD",
|
||||
"availability_type": "REGIONAL",
|
||||
"user_name": "qlikadmin",
|
||||
"user_password": "Qlik1234!"
|
||||
}
|
||||
98
bt-autoscaler/terraform/roots/file/variables.tf
Normal file
98
bt-autoscaler/terraform/roots/file/variables.tf
Normal file
@@ -0,0 +1,98 @@
|
||||
variable "project_id" {
|
||||
type = string
|
||||
description = "The project ID to manage the Cloud SQL resources"
|
||||
}
|
||||
|
||||
variable "database_version" {
|
||||
description = "The database version to use"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
description = "GCP Region"
|
||||
default = "us-central1"
|
||||
}
|
||||
|
||||
variable "db_tier" {
|
||||
description = "The tier for the primary SQL instance."
|
||||
type = string
|
||||
default = "db-f1-micro"
|
||||
}
|
||||
|
||||
variable "file_tier" {
|
||||
description = "The tier for the Filestore instance."
|
||||
type = string
|
||||
default = "BASIC_HDD"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "Zone target"
|
||||
}
|
||||
|
||||
variable "availability_type" {
|
||||
description = "The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`."
|
||||
type = string
|
||||
default = "REGIONAL"
|
||||
}
|
||||
|
||||
variable "backup_configuration" {
|
||||
description = "The backup_configuration settings subblock for the database setings"
|
||||
type = object({
|
||||
enabled = bool
|
||||
start_time = string
|
||||
location = string
|
||||
})
|
||||
default = {
|
||||
enabled = false
|
||||
start_time = null
|
||||
location = null
|
||||
}
|
||||
}
|
||||
|
||||
# variable "authorized_networks_a" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "71.164.77.198/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_b" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_c" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
variable "private_network" {
|
||||
description = "Full path to private network ID"
|
||||
type = string
|
||||
default = "projects/esoteric-parsec-243510/global/networks/private-network"
|
||||
}
|
||||
|
||||
variable "user_name" {
|
||||
description = "The name of the default user"
|
||||
type = string
|
||||
default = "default"
|
||||
}
|
||||
|
||||
variable "user_password" {
|
||||
description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "additional_users" {
|
||||
description = "A list of users to be created in your cluster"
|
||||
type = list(object({
|
||||
name = string
|
||||
password = string
|
||||
}))
|
||||
default = []
|
||||
}
|
||||
|
||||
22
bt-autoscaler/terraform/roots/geo/main.tf
Normal file
22
bt-autoscaler/terraform/roots/geo/main.tf
Normal file
@@ -0,0 +1,22 @@
|
||||
terraform {
|
||||
required_version = ">= 0.12"
|
||||
}
|
||||
|
||||
provider "google" {
|
||||
version = "3.10.0"
|
||||
credentials = file("esoteric-parsec-243510-a8f93bb5a906.json")
|
||||
project = var.project
|
||||
region = var.region
|
||||
zone = var.zone
|
||||
}
|
||||
|
||||
data "google_compute_instance_group" "geo" {
|
||||
name = "GeoAnalyticsServer"
|
||||
zone = var.zone
|
||||
}
|
||||
|
||||
# Create random ID for VM suffix
|
||||
resource "random_id" "vm_suffix" {
|
||||
byte_length = 2
|
||||
}
|
||||
|
||||
9
bt-autoscaler/terraform/roots/geo/outputs.tf
Normal file
9
bt-autoscaler/terraform/roots/geo/outputs.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
# Configure return values from google_sql_database_instance
|
||||
|
||||
output "psql_ip_address" {
|
||||
value = google_sql_database_instance.qseow-psql.private_ip_address
|
||||
}
|
||||
|
||||
output "psql_instance_name" {
|
||||
value = google_sql_database_instance.qseow-psql.connection_name
|
||||
}
|
||||
92
bt-autoscaler/terraform/roots/geo/variables.tf
Normal file
92
bt-autoscaler/terraform/roots/geo/variables.tf
Normal file
@@ -0,0 +1,92 @@
|
||||
variable "project_id" {
|
||||
type = string
|
||||
description = "The project ID to manage the Cloud SQL resources"
|
||||
}
|
||||
|
||||
variable "database_version" {
|
||||
description = "The database version to use"
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
description = "GCP Region"
|
||||
default = "us-central1"
|
||||
}
|
||||
|
||||
variable "tier" {
|
||||
description = "The tier for the master instance."
|
||||
type = string
|
||||
default = "db-f1-micro"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "Zone target"
|
||||
}
|
||||
|
||||
variable "availability_type" {
|
||||
description = "The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`."
|
||||
type = string
|
||||
default = "REGIONAL"
|
||||
}
|
||||
|
||||
variable "backup_configuration" {
|
||||
description = "The backup_configuration settings subblock for the database setings"
|
||||
type = object({
|
||||
enabled = bool
|
||||
start_time = string
|
||||
location = string
|
||||
})
|
||||
default = {
|
||||
enabled = false
|
||||
start_time = null
|
||||
location = null
|
||||
}
|
||||
}
|
||||
|
||||
# variable "authorized_networks_a" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "71.164.77.198/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_b" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
# variable "authorized_networks_c" {
|
||||
# description = "CIDR Block to add to network ACL"
|
||||
# type = string
|
||||
# default = "127.0.0.1/32"
|
||||
# }
|
||||
|
||||
variable "private_network" {
|
||||
description = "Full path to private network ID"
|
||||
type = string
|
||||
default = "projects/esoteric-parsec-243510/global/networks/private-network"
|
||||
}
|
||||
|
||||
variable "user_name" {
|
||||
description = "The name of the default user"
|
||||
type = string
|
||||
default = "default"
|
||||
}
|
||||
|
||||
variable "user_password" {
|
||||
description = "The password for the default user. If not set, a random one will be generated and available in the generated_user_password output variable."
|
||||
type = string
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "additional_users" {
|
||||
description = "A list of users to be created in your cluster"
|
||||
type = list(object({
|
||||
name = string
|
||||
password = string
|
||||
}))
|
||||
default = []
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"Modules":[{"Key":"","Source":"","Dir":"."},{"Key":"postgres","Source":"github.com/gruntwork-io/terraform-google-sql.git//modules/cloud-sql?ref=v0.2.0","Dir":".terraform/modules/postgres/modules/cloud-sql"}]}
|
||||
@@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
terraform state rm google_sql_user.users
|
||||
terraform destroy $@
|
||||
terraform destroy $@ -auto-approve
|
||||
|
||||
@@ -22,7 +22,7 @@ resource "google_sql_database_instance" "qseow-psql" {
|
||||
database_version = var.database_version
|
||||
|
||||
settings {
|
||||
tier = var.tier
|
||||
tier = var.db_tier
|
||||
availability_type = var.availability_type
|
||||
backup_configuration {
|
||||
enabled = "true"
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"project_id": "esoteric-parsec-243510",
|
||||
"region": "us-central1",
|
||||
"zone": "us-central1-a",
|
||||
"region": "europe-west1",
|
||||
"zone": "europe-west1-d",
|
||||
"private_network": "projects/esoteric-parsec-243510/global/networks/default",
|
||||
"database_version": "POSTGRES_9_6",
|
||||
"tier": "db-g1-small",
|
||||
"db_tier": "db-g1-small",
|
||||
"file_tier": "BASIC_HDD",
|
||||
"availability_type": "REGIONAL",
|
||||
"user_name": "qlikadmin",
|
||||
"user_password": "Qlik1234!"
|
||||
|
||||
@@ -10,25 +10,31 @@ variable "database_version" {
|
||||
|
||||
variable "region" {
|
||||
type = string
|
||||
description = "The region of the Cloud SQL resources"
|
||||
description = "GCP Region"
|
||||
default = "us-central1"
|
||||
}
|
||||
|
||||
variable "tier" {
|
||||
description = "The tier for the master instance."
|
||||
variable "db_tier" {
|
||||
description = "The tier for the primary SQL instance."
|
||||
type = string
|
||||
default = "db-f1-micro"
|
||||
}
|
||||
|
||||
variable "file_tier" {
|
||||
description = "The tier for the Filestore instance."
|
||||
type = string
|
||||
default = "BASIC_HDD"
|
||||
}
|
||||
|
||||
variable "zone" {
|
||||
type = string
|
||||
description = "The zone for the master instance, it should be something like: `a`, `c`."
|
||||
description = "Zone target"
|
||||
}
|
||||
|
||||
variable "availability_type" {
|
||||
description = "The availability type for the master instance.This is only used to set up high availability for the PostgreSQL instance. Can be either `ZONAL` or `REGIONAL`."
|
||||
type = string
|
||||
default = "ZONAL"
|
||||
default = "REGIONAL"
|
||||
}
|
||||
|
||||
variable "backup_configuration" {
|
||||
|
||||
10
bt-autoscaler/win-nfs_client-install.ps1
Normal file
10
bt-autoscaler/win-nfs_client-install.ps1
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env pwsh
|
||||
# Install NFS Client on Windows via PS
|
||||
#
|
||||
Install-WindowsFeature -Name NFS-Client
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" `
|
||||
-Name "AnonymousUid" -Value "0" -PropertyType DWORD
|
||||
New-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\ClientForNFS\CurrentVersion\Default" `
|
||||
-Name "AnonymousGid" -Value "0" -PropertyType DWORD
|
||||
nfsadmin client stop
|
||||
nfsadmin client start
|
||||
Reference in New Issue
Block a user