72 lines
1.7 KiB
HCL
72 lines
1.7 KiB
HCL
terraform {
|
|
|
|
required_version = ">= 0.14"
|
|
|
|
required_providers {
|
|
aws = {
|
|
source = "hashicorp/aws"
|
|
version = ">= 6.0.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
resource "random_password" "password" {
|
|
length = 16
|
|
special = true
|
|
override_special = "_!"
|
|
min_numeric = 1
|
|
upper = true
|
|
lower = true
|
|
numeric = true
|
|
min_lower = 2
|
|
min_upper = 2
|
|
min_special = 2
|
|
}
|
|
|
|
locals {
|
|
s3_prefix = "redshift/qmi-${var.provision_id}"
|
|
provid5 = substr(var.provision_id, 0, 5)
|
|
vpc_id = (var.region == "eu-west-1") ? var.vpc_id_eu : (var.region == "us-east-1") ? var.vpc_id_us : var.vpc_id_ap
|
|
subnet_ids = (var.region == "eu-west-1") ? var.subnet_ids_eu : (var.region == "us-east-1") ? var.subnet_ids_us : var.subnet_ids_ap
|
|
port = "5439"
|
|
tags = {
|
|
Deployment = "QMI PoC"
|
|
"Cost Center" = "3100"
|
|
QMI_user = var.user_id
|
|
ProvID = var.provision_id
|
|
Name = "qmi-${var.provision_id}"
|
|
Owner = var.user_id
|
|
forced_destroy = var.forced_destroy
|
|
}
|
|
}
|
|
|
|
module "qmi-s3-bucket" {
|
|
|
|
source = "git::https://gitlab.com/qmi/qmi-cloud-tf-modules.git//s3-bucket"
|
|
|
|
provision_id = var.provision_id
|
|
user_id = var.user_id
|
|
|
|
forced_destroy = var.forced_destroy
|
|
}
|
|
|
|
|
|
resource "aws_redshift_cluster" "qmi" {
|
|
cluster_identifier = "qmi-${var.provision_id}"
|
|
database_name = var.cluster_database_name
|
|
master_username = var.cluster_master_username
|
|
master_password = random_password.password.result
|
|
node_type = "ra3.large"
|
|
cluster_type = "single-node"
|
|
|
|
skip_final_snapshot = true
|
|
|
|
vpc_security_group_ids = [aws_security_group.allow_tls.id, aws_security_group.allow_tls_2.id]
|
|
|
|
publicly_accessible = true
|
|
|
|
tags = local.tags
|
|
}
|
|
|
|
|