From c8283ec4d197bdff3932a4c398e8090ce32377d3 Mon Sep 17 00:00:00 2001 From: Anna Shcherbak Date: Fri, 31 May 2024 16:56:39 +0300 Subject: [PATCH] skip: update autotest for network, qldb, sagemaker --- .github/workflows/tf_testing.yml | 2 +- auto_policy_testing/green/network/network.tf | 13 +++++++++-- auto_policy_testing/green/qldb/qldb.tf | 17 ++++++++++++-- .../green/sagemaker/sagemaker.tf | 20 +--------------- auto_policy_testing/red/network/network.tf | 8 +++++-- auto_policy_testing/red/qldb/qldb.tf | 2 +- .../red/sagemaker/sagemaker.tf | 23 +++---------------- .../scripts/aws_map_report_fields.json | 2 +- .../shared_tf_modules/naming/outputs.tf | 2 ++ 9 files changed, 41 insertions(+), 48 deletions(-) diff --git a/.github/workflows/tf_testing.yml b/.github/workflows/tf_testing.yml index 93db8a10..8317ff8e 100644 --- a/.github/workflows/tf_testing.yml +++ b/.github/workflows/tf_testing.yml @@ -22,7 +22,7 @@ env: CORE_TESTING_FOLDER: ${{ github.workspace }} OUTPUT_DIR: ${{ github.workspace }}/auto_policy_testing/output AWS_DEFAULT_REGION: ${{ vars.AWS_REGION }} - resource_priority_list: 'kafka' + resource_priority_list: 'network,qldb,sagemaker' RED: '\033[0;31m' jobs: diff --git a/auto_policy_testing/green/network/network.tf b/auto_policy_testing/green/network/network.tf index 67b71de3..1bd3f4f2 100644 --- a/auto_policy_testing/green/network/network.tf +++ b/auto_policy_testing/green/network/network.tf @@ -1,13 +1,22 @@ resource "aws_network_acl" "this" { - vpc_id = data.terraform_remote_state.common.outputs.vpc_id - subnet_ids = [data.terraform_remote_state.common.outputs.vpc_subnet_1_id] + vpc_id = data.terraform_remote_state.common.outputs.vpc_id + subnet_ids = [data.terraform_remote_state.common.outputs.vpc_subnet_1_id] + tags = { + Name = "${module.naming.resource_prefix.nacl}" + } } resource "aws_eip" "this" { instance = aws_instance.this.id + tags = { + Name = "${module.naming.resource_prefix.eip}" + } } resource "aws_instance" "this" { ami = data.aws_ami.this.id instance_type = "t2.micro" + tags = { + Name = "${module.naming.resource_prefix.ec2_instance}" + } } diff --git a/auto_policy_testing/green/qldb/qldb.tf b/auto_policy_testing/green/qldb/qldb.tf index 39f6ec8c..b079eb0a 100644 --- a/auto_policy_testing/green/qldb/qldb.tf +++ b/auto_policy_testing/green/qldb/qldb.tf @@ -1,5 +1,18 @@ resource "aws_qldb_ledger" "this" { - name = "${module.naming.resource_prefix.qldb}" + name = module.naming.resource_prefix.qldb permissions_mode = "STANDARD" - # deletion_protection = true + deletion_protection = true } + +resource "null_resource" "this" { + triggers = { + qldb = aws_qldb_ledger.this.id + } + + provisioner "local-exec" { + when = destroy + command = "aws qldb update-ledger --name ${self.triggers.qldb} --no-deletion-protection" + } + + depends_on = [aws_qldb_ledger.this] +} \ No newline at end of file diff --git a/auto_policy_testing/green/sagemaker/sagemaker.tf b/auto_policy_testing/green/sagemaker/sagemaker.tf index e1e62497..afe04003 100644 --- a/auto_policy_testing/green/sagemaker/sagemaker.tf +++ b/auto_policy_testing/green/sagemaker/sagemaker.tf @@ -21,6 +21,7 @@ resource "aws_sagemaker_model" "this" { } resource "aws_iam_role" "this" { + name = "${module.naming.resource_prefix.sagemaker_notebook}" assume_role_policy = data.aws_iam_policy_document.this.json } @@ -35,25 +36,6 @@ resource "aws_sagemaker_notebook_instance" "this" { root_access = "Disabled" } -resource "aws_iam_role" "this2" { - name = "${module.naming.resource_prefix.sagemaker_notebook}" - - assume_role_policy = <