Skip to content

Commit

Permalink
Add KMS cloudwatch logging infra deploy and undeploy support in PC in…
Browse files Browse the repository at this point in the history
…stallation toolkit (facebookresearch#2345)

Summary:
Pull Request resolved: facebookresearch#2345

This diff is adds support for deploying and destroying the complete advertiser side KMS logging infrastructure as part of PC deployment toolkit

{F1103647801}

Reviewed By: ankushksingh

Differential Revision: D49679090

fbshipit-source-id: 605fa1620c4c6c5a005a5346f7237759fd823c9d
  • Loading branch information
somnathfb authored and facebook-github-bot committed Sep 28, 2023
1 parent d9de922 commit 24f428e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions fbpcs/infra/cloud_bridge/deploy_pc_infra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,27 @@ undeploy_aws_resources() {
-var "query_results_key_path=$query_results_key_path"
echo "########################Deletion completed########################"

echo "######################## Deleting Advertiser Side KMS Logging Infrastructure ######################"
log_streaming_data "starting to delete Advertiser side KMS logging infra"

cd /terraform_deployment/terraform_scripts/advertiser_infra_logging/kms_logging

terraform init -reconfigure \
-backend-config "bucket=$s3_bucket_config" \
-backend-config "region=$region" \
-backend-config "key=tfstate/kms_logging_infra_$tag_postfix.tfstate"

terraform destroy \
-auto-approve \
-var "region=$region" \
-var "s3_logging_bucket_name=$s3_logging_bucket" \
-var "kinesis_log_stream_name=$kinesis_stream_name" \
-var "user_identity_regex=$kms_user_identity_regex" \
-var "installation_tag=log$tag_postfix"

echo "######################## Cleaned up Advertiser Side KMS Logging Infrastructure ######################"
log_streaming_data "Cleaned up Advertiser side KMS logging infra"

echo "######################## Destroy Advertiser Side S3 Buckets Logging Infrastructure ######################"
cd /terraform_deployment/terraform_scripts/advertiser_infra_logging/s3_bucket_logging

Expand Down Expand Up @@ -542,6 +563,27 @@ deploy_aws_resources() {
log_streaming_data "deployed lambda logging infra"
echo "######################## Deployed Advertiser Side Lambda Logging Infrastructure ######################"

echo "######################## Deploy Advertiser Side KMS Logging Infrastructure ######################"
log_streaming_data "starting to deploy Advertiser side KMS logging infra"

cd /terraform_deployment/terraform_scripts/advertiser_infra_logging/kms_logging

terraform init -reconfigure \
-backend-config "bucket=$s3_bucket_config" \
-backend-config "region=$region" \
-backend-config "key=tfstate/kms_logging_infra_$tag_postfix.tfstate"

terraform apply \
-auto-approve \
-var "region=$region" \
-var "s3_logging_bucket_name=$s3_logging_bucket" \
-var "kinesis_log_stream_name=$kinesis_stream_name" \
-var "user_identity_regex=$kms_user_identity_regex" \
-var "installation_tag=log$tag_postfix"

echo "######################## Deployed Advertiser Side KMS Logging Infrastructure ######################"
log_streaming_data "finished deploying Advertiser side KMS logging infra"

echo "########################Finished AWS Infrastructure Deployment########################"
log_streaming_data "finished deploying resources..."

Expand Down Expand Up @@ -591,6 +633,7 @@ s3_logging_bucket="s3-log-bucket-advertiser$tag_postfix"
kinesis_stream_name="kinesis-log-stream-advertiser$tag_postfix"
kinesis_read_role_name="kinesis-read-role$tag_postfix"
kinesis_read_policy_name="kinesis-read-policy$tag_postfix"
kms_user_identity_regex=".*${kia_lambda_function_name}|${data_ingestion_lambda_name}|${clean_up_agent_lambda_function_name}.*"

if "$undeploy"
then
Expand Down

0 comments on commit 24f428e

Please sign in to comment.