Skip to content

Commit

Permalink
Merge branch 'master' into ZFE-78488-enable-role-superset
Browse files Browse the repository at this point in the history
  • Loading branch information
zgnegrete authored Oct 12, 2023
2 parents 60faa4b + 50622a8 commit 19ca2a8
Show file tree
Hide file tree
Showing 31 changed files with 570 additions and 284 deletions.
32 changes: 24 additions & 8 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ type: docker
name: terra

steps:
- name: plan
- name: plan-insights
pull: if-not-exists
image: hashicorp/terraform:0.11.15
image: hashicorp/terraform:0.14.10
environment:
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID:
Expand All @@ -19,11 +19,27 @@ steps:
- apk add -U make openssh-client jq zip
- mkdir ~/.ssh && echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- make -C .terra/superset init
- make -C .terra/superset validate
- make -C .terra/insights init
- make -C .terra/insights validate

- name: plan-superset
pull: if-not-exists
image: hashicorp/terraform:0.12.31
environment:
AWS_REGION: us-west-2
AWS_ACCESS_KEY_ID:
from_secret: AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY:
from_secret: AWS_SECRET_ACCESS_KEY
SSH_PRIVATE_KEY:
from_secret: SSH_PRIVATE_KEY
commands:
- apk add -U make openssh-client jq zip
- mkdir ~/.ssh && echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- make -C .terra/superset init
- make -C .terra/superset validate

- name: unit-test
pull: if-not-exists
image: python:3.9
Expand All @@ -33,15 +49,15 @@ steps:
- mkdir ~/.ssh && echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- apt-get update && apt-get install libsasl2-dev
- pip install -r requirements/testing.txt
- cp -R bi_superset/ superset/bi_superset/
- pip install -r requirements/testing.txt
- cp -R bi_superset/ superset/bi_superset/
- cp bi_superset/superset_config.py superset/superset_config.py
- cp bi_superset/bi_cli/bi_cli.py superset/cli/bi_cli.py
- cp -R zf_integration/ superset/zf_integration/
- cp zf_utils/jwt.py superset/utils/jwt.py
- pip install coverage
- pytest ./tests/unit_tests/


---
kind: pipeline
Expand All @@ -57,7 +73,7 @@ steps:
commands:
- mkdir ~/.ssh && echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_ed25519 && chmod 0600 ~/.ssh/id_ed25519
- ssh-keyscan -H github.com >> ~/.ssh/known_hosts
- cp -R bi_superset/ superset/bi_superset/
- cp -R bi_superset/ superset/bi_superset/
- cp bi_superset/superset_config.py superset/superset_config.py
- cp bi_superset/bi_cli/bi_cli.py superset/cli/bi_cli.py
- cp -R zf_integration/ superset/zf_integration/
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ cache/
dev
secrets/
secrets
.secrets/
.secrets/
.terraform
101 changes: 101 additions & 0 deletions .terra/insights/.terraform.lock.hcl

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .terra/insights/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ validate: ${tf_files}
$(TERRAFORM) validate

plan: .terraform/terraform.tfstate ${tf_files}
$(TERRAFORM) plan \
TF_LOG=TRACE && $(TERRAFORM) plan \
-var "env=$(ENVIRONMENT)" \
-var "git_sha=$(GIT_SHA)" \
-out terra.plan

apply: plan
$(TERRAFORM) apply terra.plan
TF_LOG=TRACE && $(TERRAFORM) apply terra.plan

clean:
rm -f *.backup *.plan
Expand Down
43 changes: 25 additions & 18 deletions .terra/insights/celery_beat/celery_beat.tf
Original file line number Diff line number Diff line change
@@ -1,28 +1,34 @@
variable "app" {}
variable "app" {
}

variable "env" {}
variable "env" {
}

variable "aws_region" {
default = "us-west-2"
}

variable "git_sha" {}
variable "git_sha" {
}

variable "cmd" {
default = "celery-beat"
}

variable "ecr_url" {}
variable "ecr_url" {
}

variable "db_address" {}
variable "db_address" {
}

variable "db_port" {}
variable "db_port" {
}

# ----------------------------------------
# AWS
# ----------------------------------------
provider "aws" {
region = "${var.aws_region}"
region = var.aws_region
}

# ----------------------------------------
Expand All @@ -37,19 +43,20 @@ locals {
}

data "template_file" "nomad_group" {
template = "${file("./celery_beat/celery_beat.nomad.hcl")}"

vars {
aws_region = "${var.aws_region}"
ecr_url = "${var.ecr_url}"
git_sha = "${var.git_sha}"
app = "${var.app}"
db_address = "${var.db_address}"
db_port = "${var.db_port}"
count = "${local.container_counts[var.env]}"
template = file("./celery_beat/celery_beat.nomad.hcl")

vars = {
aws_region = var.aws_region
ecr_url = var.ecr_url
git_sha = var.git_sha
app = var.app
db_address = var.db_address
db_port = var.db_port
count = local.container_counts[var.env]
}
}

output "nomad_group" {
value = "${data.template_file.nomad_group.rendered}"
value = data.template_file.nomad_group.rendered
}

4 changes: 4 additions & 0 deletions .terra/insights/celery_beat/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
46 changes: 27 additions & 19 deletions .terra/insights/celery_flower/celery_flower.tf
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
variable "app" {}
variable "app" {
}

variable "env" {}
variable "env" {
}

variable "aws_region" {}
variable "aws_region" {
}

variable "git_sha" {}
variable "git_sha" {
}

variable "cmd" {
default = "celery-flower"
}

variable "ecr_url" {}
variable "ecr_url" {
}

variable "db_address" {}
variable "db_address" {
}

variable "db_port" {}
variable "db_port" {
}

# ----------------------------------------
# AWS
# ----------------------------------------
provider "aws" {
region = "${var.aws_region}"
region = var.aws_region
}

# ----------------------------------------
Expand All @@ -35,19 +42,20 @@ locals {
}

data "template_file" "nomad_group" {
template = "${file("./celery_flower/celery_flower.nomad.hcl")}"

vars {
aws_region = "${var.aws_region}"
ecr_url = "${var.ecr_url}"
git_sha = "${var.git_sha}"
app = "${var.app}"
db_address = "${var.db_address}"
db_port = "${var.db_port}"
count = "${local.container_counts[var.env]}"
template = file("./celery_flower/celery_flower.nomad.hcl")

vars = {
aws_region = var.aws_region
ecr_url = var.ecr_url
git_sha = var.git_sha
app = var.app
db_address = var.db_address
db_port = var.db_port
count = local.container_counts[var.env]
}
}

output "nomad_group" {
value = "${data.template_file.nomad_group.rendered}"
value = data.template_file.nomad_group.rendered
}

4 changes: 4 additions & 0 deletions .terra/insights/celery_flower/versions.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

terraform {
required_version = ">= 0.12"
}
Loading

0 comments on commit 19ca2a8

Please sign in to comment.