Skip to content

Commit e899a74

Browse files
Merge pull request #958 from NHSDigital/feature/made14-NRL-1511-ptl-dashboards-updates
NRL-1511 Pre-prod release fixups for dashboards changes
2 parents e1f053a + 01b9cba commit e899a74

File tree

26 files changed

+156
-33
lines changed

26 files changed

+156
-33
lines changed

terraform/account-wide-infrastructure/README.md

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -136,35 +136,20 @@ To disable reporting resources for the account, do the following:
136136
1. Set the `enable_reporting` variable to `true` in `./ACCOUNT_NAME/vars.tf`
137137
2. Deploy the account-wide infrastructure to the account
138138
139-
#### Deploying the PowerBI Gateway
139+
#### Deploy the PowerBI Gateway
140140
141-
The first time you deploy the PowerBI Gateway set up to a new account, these steps need to be followed:
141+
The first time you deploy the PowerBI Gateway to an AWS account you need to create, install and configure a gateway image. Instruction on how to do this can be found in [KOP-NRLF-012](https://nhsd-confluence.digital.nhs.uk/x/8BXXQg).
142142
143-
1. Set the `enable_powerbi_auto_push` variable to `true` in `./ACCOUNT_NAME/vars.tf`
144-
2. Set the `use_powerbi_gw_custom_ami` variable to `false` in `./ACCOUNT_NAME/vars.tf`
145-
3. Deploy the account-wide infrastructure for the account
146-
4. Run the below CLI command, and RDP into the newly created EC2 instance (localhost:13389)
147-
148-
```
149-
aws ssm start-session --target <AMI> --document-name AWS-StartPortForwardingSession --parameters "localPortNumber=13389,portNumber=3389"
150-
```
143+
To enable the PowerBI Gateway in the account:
151144
152-
5. Install Athena ODBC driver and Power BI standard on premises gateway
153-
6. Configure ODBC driver to connect to relevant Athena instance
154-
7. Log in to the gateway using NHS email, name the cluster to nhsd-nrlf-{env}--reporting-gw
155-
8. Log on to power bi, navigate to Manage Connections and Gateways in settings and set up Athena connector with authentication method: Anonymous and privacy level: Private
156-
9. Set dataset to point to this gateway, define schedule as needed
157-
10. In the AWS Console, create an AMI from the instance called `PowerBI_GW`
158-
11. Set the `use_powerbi_gw_custom_ami` variable to `true`
159-
12. Deploy the account-wide infrastructure for the account
160-
13. Run the below CLI command, and RDP into the newly created EC2 instance (localhost:13389)
145+
1. Set the `enable_powerbi_auto_push` variable to `true` in `./ACCOUNT_NAME/vars.tf`
146+
2. Deploy the account-wide infrastructure to the account
147+
3. Access the EC2 Serial Console for the instance and run this command to start the PowerBI Gateway:
161148
162149
```
163-
aws ssm start-session --target <AMI> --document-name AWS-StartPortForwardingSession --parameters "localPortNumber=13389,portNumber=3389"
150+
Start-Service -Name "PBIEgwService"
164151
```
165152
166-
14. Start the PowerBI Gateway service on the instance
167-
168153
To disable the PowerBI Gateway from the account:
169154
170155
1. Set the `enable_powerbi_auto_push` variable to `false` in `./ACCOUNT_NAME/vars.tf`

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ module "dev-athena" {
33
source = "../modules/athena"
44
name_prefix = "nhsd-nrlf--dev"
55
target_bucket_name = module.dev-glue.target_bucket_name
6+
bucket_region = data.aws_region.current.region
67
glue_database = module.dev-glue.glue_database
78
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
data "aws_region" "current" {}
2+
13
data "aws_secretsmanager_secret_version" "identities_account_id" {
24
secret_id = aws_secretsmanager_secret.identities_account_id.name
35
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ terraform {
2929
key = "terraform-state-account-wide-infrastructure"
3030
workspace_key_prefix = "nhsd-nrlf"
3131
}
32+
33+
34+
required_providers {
35+
aws = {
36+
source = "hashicorp/aws"
37+
version = "~> 6.0"
38+
}
39+
}
3240
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
output "powerbi_gw_instance_id" {
2+
description = "The ID of the PowerBI Gateway EC2 instance."
3+
value = var.enable_powerbi_auto_push ? module.powerbi_gw_instance[0].instance_id : null
4+
}
5+
6+
output "reporting_database_name" {
7+
description = "Name of the reporting Athena database"
8+
value = var.enable_reporting ? module.dev-glue.glue_database : null
9+
}
10+
11+
output "athena_workgroup_name" {
12+
description = "Name of the Athena workgroup"
13+
value = var.enable_reporting ? module.dev-athena[0].workgroup_name : null
14+
}
15+
16+
output "athena_s3_output_location" {
17+
description = "S3 output location for Athena queries"
18+
value = var.enable_reporting ? "s3://${module.dev-athena[0].bucket.id}/" : null
19+
}
20+
21+
output "athena_kms_key_arn" {
22+
description = "KMS key ARN for Athena encryption"
23+
value = var.enable_reporting ? module.dev-athena[0].kms_key_arn : null
24+
}

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,13 @@ resource "aws_secretsmanager_secret" "devsandbox_environment_configuration" {
4141
name = "${local.project}--dev-sandbox--env-config"
4242
description = "The environment configuration for the Dev Sandbox environment"
4343
}
44+
45+
resource "aws_secretsmanager_secret" "powerbi_gw_instance_admin_pwd" {
46+
count = var.enable_reporting && var.enable_powerbi_auto_push ? 1 : 0
47+
name = "${local.project}--dev-powerbi-gw-instance-admin-pwd"
48+
description = "Admin password for the PowerBI Gateway EC2 instance"
49+
}
50+
resource "aws_secretsmanager_secret" "powerbi_gw_recovery_key" {
51+
name = "${local.project}--dev-powerbi-gw-recovery-key"
52+
description = "Recovery key for the PowerBI Gateway EC2 instance"
53+
}

terraform/account-wide-infrastructure/mgmt/codebuild.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ data "aws_iam_policy_document" "codebuild_policy" {
5656
"secretsmanager:ListSecretVersionIds"
5757
]
5858
resources = [
59-
"arn:aws:secretsmanager:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:secret:${local.project}--codebuild-github-pat-*",
59+
"arn:aws:secretsmanager:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:secret:${local.project}--codebuild-github-pat-*",
6060
]
6161
}
6262

terraform/account-wide-infrastructure/modules/athena/outputs.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
output "workgroup" {
2-
value = aws_athena_workgroup.athena
1+
output "workgroup_name" {
2+
value = aws_athena_workgroup.athena.name
33
}
44

55
output "bucket" {

terraform/account-wide-infrastructure/modules/athena/vars.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ variable "name_prefix" {
33
description = "The prefix to apply to all resources in the module."
44
}
55

6+
variable "bucket_region" {
7+
type = string
8+
description = "The AWS region where the S3 bucket will be created."
9+
}
10+
611
variable "target_bucket_name" {
712
type = string
813
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
locals {
2-
resource_name_prefix = "${data.aws_region.current.name}-${data.aws_caller_identity.current.account_id}-backup"
2+
resource_name_prefix = "${data.aws_region.current.region}-${data.aws_caller_identity.current.account_id}-backup"
33
}

0 commit comments

Comments
 (0)