Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Commit

Permalink
Smoke test: also test deploy alerting module with terraform (#1029)
Browse files Browse the repository at this point in the history
* Smoke test include en-alerting module

* Terraform delete more resilient

* Depends on module.en
  • Loading branch information
chaodaiG authored Dec 3, 2020
1 parent 5a4f741 commit 76c73aa
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/ci-terraform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function destroy() {
# especially when previous terraform deployment failed. So grepping from terraform state instead.
db_inst_name="$(terraform state show module.en.google_sql_database_instance.db-inst | grep -Eo 'name.*=.*"terraform-[a-zA-Z0-9]+"' | grep -Eo 'terraform-[a-zA-Z0-9]+' | uniq)" || best_effort
if [[ -n "${db_inst_name}" ]]; then
gcloud sql instances delete ${db_inst_name} -q --project=${PROJECT_ID}
gcloud sql instances delete ${db_inst_name} -q --project=${PROJECT_ID} || best_effort
fi
# Clean up states after manual DB delete
terraform state rm module.en.google_sql_user.user || best_effort
Expand All @@ -149,6 +149,7 @@ function destroy() {
local vpc_connector_name="serverless-vpc-connector"
gcloud compute networks vpc-access connectors delete ${vpc_connector_name} -q --region us-central1 --project=$PROJECT_ID || best_effort

echo "Start terraform destroy"
terraform destroy -auto-approve
popd > /dev/null
}
Expand Down
13 changes: 13 additions & 0 deletions terraform-e2e-ci/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,19 @@ module "en" {
}
}

module "en-alerting" {
source = "../terraform/alerting"

monitoring-host-project = var.project
verification-server-project = var.project

adminapi_hosts = ["adminapi.notexistdomain.notexist"]
apiserver_hosts = ["apiserver.notexistdomain.notexist"]
server_hosts = ["encv-test.notexistdomain.notexist"]

depends_on = [module.en]
}

output "en" {
value = module.en
}

0 comments on commit 76c73aa

Please sign in to comment.