Skip to content

Commit 0e8116a

Browse files
committed
[NRL-1386] Add missing glue_database to test+prod. Fix TF apply state issues
1 parent 910dd30 commit 0e8116a

File tree

9 files changed

+30
-31
lines changed

9 files changed

+30
-31
lines changed

terraform/account-wide-infrastructure/dev/ec2.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module "powerbi_gw_instance" {
1414
source = "../modules/powerbi-gw-ec2"
1515
use_custom_ami = var.use_powerbi_gw_custom_ami
1616
instance_type = var.powerbi_gw_instance_type
17-
name_prefix = "nhsd-nrlf--dev-powerbi-gw-v2"
17+
name_prefix = "nhsd-nrlf--dev-powerbi-gw"
1818
target_bucket_arn = module.dev-glue.target_bucket_arn
1919
glue_kms_key_arn = module.dev-glue.aws_kms_key_arn
2020
athena_kms_key_arn = module.dev-athena.kms_key_arn

terraform/account-wide-infrastructure/modules/glue/glue.tf

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,37 @@ resource "aws_glue_crawler" "log_crawler" {
1010
database_name = aws_glue_catalog_database.log_database.name
1111
role = aws_iam_role.glue_service_role.name
1212
s3_target {
13-
path = "${aws_s3_bucket.target-data-bucket.id}/consumer_countDocumentReference/"
13+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/consumer_countDocumentReference/"
1414
}
1515
s3_target {
16-
path = "${aws_s3_bucket.target-data-bucket.id}/consumer_readDocumentReference/"
16+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/consumer_readDocumentReference/"
1717
}
1818
s3_target {
19-
path = "${aws_s3_bucket.target-data-bucket.id}/consumer_searchDocumentReference/"
19+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/consumer_searchDocumentReference/"
2020
}
2121
s3_target {
22-
path = "${aws_s3_bucket.target-data-bucket.id}/consumer_searchPostDocumentReference/"
22+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/consumer_searchPostDocumentReference/"
2323
}
2424
s3_target {
25-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_createDocumentReference/"
25+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_createDocumentReference/"
2626
}
2727
s3_target {
28-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_deleteDocumentReference/"
28+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_deleteDocumentReference/"
2929
}
3030
s3_target {
31-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_readDocumentReference/"
31+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_readDocumentReference/"
3232
}
3333
s3_target {
34-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_searchDocumentReference/"
34+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_searchDocumentReference/"
3535
}
3636
s3_target {
37-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_searchPostDocumentReference/"
37+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_searchPostDocumentReference/"
3838
}
3939
s3_target {
40-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_updateDocumentReference/"
40+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_updateDocumentReference/"
4141
}
4242
s3_target {
43-
path = "${aws_s3_bucket.target-data-bucket.id}/producer_upsertDocumentReference/"
43+
path = "s3://${aws_s3_bucket.target-data-bucket.id}/producer_upsertDocumentReference/"
4444
}
4545
schema_change_policy {
4646
delete_behavior = "LOG"

terraform/account-wide-infrastructure/modules/glue/s3.tf

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ resource "aws_s3_bucket_public_access_block" "code-bucket-public-access-block" {
180180
}
181181

182182
resource "aws_s3_object" "script" {
183-
bucket = aws_s3_bucket.code-bucket.bucket
184-
key = "main.py"
185-
source = "${path.module}/src/main.py"
186-
etag = filemd5("${path.module}/src/main.py")
183+
bucket = aws_s3_bucket.code-bucket.bucket
184+
key = "main.py"
185+
source = "${path.module}/src/main.py"
186+
source_hash = filemd5("${path.module}/src/main.py")
187187
}
188188

189189
data "archive_file" "python" {
@@ -194,8 +194,8 @@ data "archive_file" "python" {
194194
}
195195

196196
resource "aws_s3_object" "zip" {
197-
bucket = aws_s3_bucket.code-bucket.bucket
198-
key = "src.zip"
199-
source = data.archive_file.python.output_path
200-
etag = filemd5(data.archive_file.python.output_path)
197+
bucket = aws_s3_bucket.code-bucket.bucket
198+
key = "src.zip"
199+
source = data.archive_file.python.output_path
200+
source_hash = filemd5(data.archive_file.python.output_path)
201201
}

terraform/account-wide-infrastructure/modules/powerbi-gw-ec2/ec2.tf

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
resource "aws_instance" "web" {
1+
resource "aws_instance" "powerbi_gw" {
22
associate_public_ip_address = false
33
iam_instance_profile = aws_iam_instance_profile.powerbi_profile.name
44
ami = local.selected_ami_id
55
instance_type = var.instance_type
66
key_name = aws_key_pair.ec2_key_pair.key_name
77
subnet_id = var.subnet_id
8-
# TODO WORK OUT WHY THIS IS HAVING SUCH AN ISSUE.....
9-
#security_groups = var.security_groups
10-
vpc_security_group_ids = var.security_groups
8+
vpc_security_group_ids = var.security_groups
119

1210
user_data = file("${path.module}/scripts/user_data.tpl")
1311

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
output "instance_id" {
2-
value = aws_instance.web.id
3-
}
4-
5-
output "public_ip" {
6-
value = aws_instance.web.public_ip
2+
value = aws_instance.powerbi_gw.id
73
}

terraform/account-wide-infrastructure/prod/athena.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ module "prod-athena" {
22
source = "../modules/athena"
33
name_prefix = "nhsd-nrlf--prod"
44
target_bucket_name = module.prod-glue.target_bucket_name
5+
glue_database = module.prod-glue.glue_database
56
}

terraform/account-wide-infrastructure/prod/ec2.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module "powerbi_gw_instance" {
1414
source = "../modules/powerbi-gw-ec2"
1515
use_custom_ami = false
1616
instance_type = var.powerbi_gw_instance_type
17-
name_prefix = "nhsd-nrlf--test-powerbi-gw-v2"
17+
name_prefix = "nhsd-nrlf--test-powerbi-gw"
1818
target_bucket_arn = module.prod-glue.target_bucket_arn
1919
glue_kms_key_arn = module.prod-glue.aws_kms_key_arn
2020
athena_kms_key_arn = module.prod-athena.kms_key_arn

terraform/account-wide-infrastructure/test/athena.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ module "qa-athena" {
22
source = "../modules/athena"
33
name_prefix = "nhsd-nrlf--qa"
44
target_bucket_name = module.qa-glue.target_bucket_name
5+
glue_database = module.qa-glue.glue_database
56
}
67

78
module "int-athena" {
89
source = "../modules/athena"
910
name_prefix = "nhsd-nrlf--int"
1011
target_bucket_name = module.int-glue.target_bucket_name
12+
glue_database = module.int-glue.glue_database
1113
}
1214

1315
module "int-sandbox-athena" {
1416
source = "../modules/athena"
1517
name_prefix = "nhsd-nrlf--int-sandbox"
1618
target_bucket_name = module.int-sandbox-glue.target_bucket_name
19+
glue_database = module.int-sandbox-glue.glue_database
1720
}
1821

1922
module "ref-athena" {
2023
source = "../modules/athena"
2124
name_prefix = "nhsd-nrlf--ref"
2225
target_bucket_name = module.ref-glue.target_bucket_name
26+
glue_database = module.ref-glue.glue_database
2327
}

terraform/account-wide-infrastructure/test/ec2.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module "powerbi_gw_instance" {
1414
source = "../modules/powerbi-gw-ec2"
1515
use_custom_ami = var.use_powerbi_gw_custom_ami
1616
instance_type = var.powerbi_gw_instance_type
17-
name_prefix = "nhsd-nrlf--test-powerbi-gw-v2"
17+
name_prefix = "nhsd-nrlf--test-powerbi-gw"
1818
target_bucket_arn = module.int-glue.target_bucket_arn
1919
glue_kms_key_arn = module.int-glue.aws_kms_key_arn
2020
athena_kms_key_arn = module.int-athena.kms_key_arn

0 commit comments

Comments
 (0)