Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use absolute paths for s3 configs #89

Merged
merged 8 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 0 additions & 74 deletions .github/workflows/terraform-deploy-data-qa-dev.yml

This file was deleted.

This file was deleted.

Binary file not shown.
8 changes: 0 additions & 8 deletions examples/basic/remote_state.tf

This file was deleted.

Empty file removed examples/basic/terraform.tfstate
Empty file.
File renamed without changes.
File renamed without changes.
39 changes: 12 additions & 27 deletions examples/basic/main.tf → examples/docker_basic/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -46,38 +46,23 @@ module "data_qa" {
push_report_image_uri = module.docker_image_push_report.image_uri

data_reports_notification_settings = {
channel = var.slack_channel
webhook_url = var.slack_webhook_url
channel = "DataQASlackChannel"
webhook_url = "https://hooks.slack.com/services/........"
}

lambda_private_subnet_ids = module.vpc.private_subnet_ids
lambda_security_group_ids = module.vpc.security_group_ids

reports_vpc_id = module.vpc.vpc_id
reports_subnet_id = module.vpc.public_subnet_ids[0]
reports_whitelist_ips = ["195.155.100.203/32"]
}

module "data_qa_intg" {
source = "../../terraform"

data_test_storage_bucket_name = "dqg-settings-intg"
environment = "intg"
project = "provectus"

allure_report_image_uri = module.docker_image_allure_report.image_uri
data_test_image_uri = module.docker_image_data_test.image_uri
push_report_image_uri = module.docker_image_push_report.image_uri

data_reports_notification_settings = {
channel = var.slack_channel
webhook_url = var.slack_webhook_url
}

lambda_private_subnet_ids = module.vpc.private_subnet_ids
lambda_security_group_ids = module.vpc.security_group_ids

reports_vpc_id = module.vpc.vpc_id
reports_subnet_id = module.vpc.public_subnet_ids[0]
reports_whitelist_ips = ["195.155.100.203/32"]
reports_whitelist_ips = ["0.0.0.0/0"] # Available from everywhere

test_coverage_path = "../../configs/test_coverage.json"
pipeline_config_path = "../../configs/pipeline.json"
pks_path = "../../configs/pks.json"
sort_keys_path = "../../configs/sort_keys.json"
mapping_path = "../../configs/mapping.json"
manifest_path = "../../configs/manifest.json"
great_expectation_path = "../../templates/great_expectations.yml"
expectations_store = "../../expectations_store"
}
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion terraform/modules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module "basic_slack_alerting" {
slack_sns_topic_name = "dqg-alerting-${var.environment}"
slack_username = "DQG-alerting"

step_functions_to_monitor = ["${local.resource_name_prefix}-fast-data-qa"]
step_functions_to_monitor = [aws_sfn_state_machine.fast_data_qa.name]

resource_name_prefix = local.resource_name_prefix
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/alerting/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "aws_kms_ciphertext" "slack_url" {

module "slack_notification" {
source = "terraform-aws-modules/notify-slack/aws"
version = "~> 5.0"
version = "6.0.0"

sns_topic_name = var.slack_sns_topic_name

Expand Down
37 changes: 19 additions & 18 deletions terraform/modules/s3-configs/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
resource "aws_s3_bucket" "settings_bucket" {
bucket = var.data_test_storage_bucket_name
bucket = var.data_test_storage_bucket_name
force_destroy = true
}

resource "aws_s3_bucket_public_access_block" "public_access_block_fast_data_qa" {
Expand All @@ -21,67 +22,67 @@ resource "aws_s3_bucket_versioning" "fast-data-qa-bucket" {
resource "aws_s3_object" "great_expectations_yml" {
bucket = aws_s3_bucket.settings_bucket.bucket
content_type = "application/x-yaml"
content = templatefile("${path.module}/${var.great_expectation_path}", {
content = templatefile("${var.great_expectation_path}", {
bucket = aws_s3_bucket.settings_bucket.bucket
})
key = "${aws_s3_bucket.settings_bucket.bucket}/great_expectations/great_expectations.yml"
etag = md5(templatefile("${path.module}/${var.great_expectation_path}", {
etag = md5(templatefile("${var.great_expectation_path}", {
bucket = aws_s3_bucket.settings_bucket.bucket
}))
}

resource "aws_s3_object" "test_configs" {
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.test_coverage_path}"
source = var.test_coverage_path
key = "test_configs/test_coverage.json"
etag = filemd5("${path.module}/${var.test_coverage_path}")
etag = filemd5("${var.test_coverage_path}")
}

resource "aws_s3_object" "pipeline_config" {
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.pipeline_config_path}"
source = var.pipeline_config_path
key = "test_configs/pipeline.json"
etag = filemd5("${path.module}/${var.pipeline_config_path}")
etag = filemd5("${var.pipeline_config_path}")
}

resource "aws_s3_object" "pks_config" {
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.pks_path}"
source = var.pks_path
key = "test_configs/pks.json"
etag = filemd5("${path.module}/${var.pks_path}")
etag = filemd5("${var.pks_path}")
}

resource "aws_s3_object" "sort_keys_config" {
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.sort_keys_path}"
source = var.sort_keys_path
key = "test_configs/sort_keys.json"
etag = filemd5("${path.module}/${var.sort_keys_path}")
etag = filemd5("${var.sort_keys_path}")
}

resource "aws_s3_object" "mapping_config" {
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.mapping_path}"
source = var.mapping_path
key = "test_configs/mapping.json"
etag = filemd5("${path.module}/${var.mapping_path}")
etag = filemd5("${var.mapping_path}")
}


resource "aws_s3_object" "expectations_store" {
for_each = fileset("${path.module}/${var.expectations_store}", "**")
for_each = fileset("${var.expectations_store}", "**")
bucket = aws_s3_bucket.settings_bucket.bucket
source = "${path.module}/${var.expectations_store}/${each.value}"
source = "${var.expectations_store}/${each.value}"
key = "${aws_s3_bucket.settings_bucket.bucket}/great_expectations/expectations/${each.value}"
etag = filemd5("${path.module}/${var.expectations_store}/${each.value}")
etag = filemd5("${var.expectations_store}/${each.value}")
}

resource "aws_s3_object" "test_config_manifest" {
bucket = aws_s3_bucket.settings_bucket.bucket
etag = md5(templatefile("${path.module}/${var.manifest_path}", {
etag = md5(templatefile("${var.manifest_path}", {
env_name = var.environment,
bucket_name = aws_s3_bucket.settings_bucket.bucket
}))
content_type = "application/json"
content = templatefile("${path.module}/${var.manifest_path}",
content = templatefile("${var.manifest_path}",
{
env_name = var.environment,
bucket_name = aws_s3_bucket.settings_bucket.bucket
Expand Down
2 changes: 1 addition & 1 deletion terraform/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "= 4.67.0"
version = "= 4.64.0"
}
local = {
source = "hashicorp/local"
Expand Down