generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3022 from ministryofjustice/data-and-insights-wep…
…i/glue-ap Data and insights wepi/glue ap
- Loading branch information
Showing
6 changed files
with
128 additions
and
222 deletions.
There are no files selected for viewing
6 changes: 3 additions & 3 deletions
6
terraform/environments/data-and-insights-wepi/bastion_linux.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{ | ||
"keys": { | ||
"development": { | ||
"preproduction": { | ||
"simonytta": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKeBrsu9K2qVs2r/fueve0V+5WBY/ZZTNq1UJYhuXIZp [email protected]" | ||
}, | ||
"test": {}, | ||
"production": {} | ||
"development": {"simonytta": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKeBrsu9K2qVs2r/fueve0V+5WBY/ZZTNq1UJYhuXIZp [email protected]"}, | ||
"production": {"simonytta": "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKeBrsu9K2qVs2r/fueve0V+5WBY/ZZTNq1UJYhuXIZp [email protected]"} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
resource "aws_glue_catalog_database" "mojap_all_tables" { | ||
name = "ap-mojap-tables-all" | ||
description = "" | ||
} | ||
|
||
resource "aws_glue_catalog_database" "sop_redshift" { | ||
name = "sop-redshift" | ||
description = "" | ||
} | ||
|
||
resource "aws_glue_crawler" "mojap_import_all" { | ||
database_name = aws_glue_catalog_database.mojap_all_tables.name | ||
name = "sop-import-all" | ||
role = aws_iam_role.wepi_iam_role_glue.arn | ||
description = "Identifies schema for SOP datasets on AP" | ||
s3_target { | ||
path = "s3://mojap-mp-redshift/" | ||
connection_name = aws_glue_connection.wepi_glue_conn_redshift.name | ||
} | ||
} | ||
|
||
resource "aws_glue_crawler" "absence_crawler" { | ||
database_name = aws_glue_catalog_database.sop_redshift.name | ||
name = "absence-redshift-schema" | ||
role = aws_iam_role.wepi_iam_role_glue.arn | ||
description = "Crawl AWS Redshift \"absence\" table using JDBC" | ||
jdbc_target { | ||
path = "wepidevelopmentdb/public/absence" | ||
connection_name = aws_glue_connection.wepi_glue_conn_redshift.name | ||
} | ||
} | ||
|
||
resource "aws_glue_crawler" "leavers_crawler" { | ||
database_name = aws_glue_catalog_database.sop_redshift.name | ||
name = "leavers-redshift-schema" | ||
role = aws_iam_role.wepi_iam_role_glue.arn | ||
description = "Crawl AWS Redshift \"leavers\" table using JDBC" | ||
jdbc_target { | ||
path = "wepidevelopmentdb/public/leavers" | ||
connection_name = aws_glue_connection.wepi_glue_conn_redshift.name | ||
} | ||
} | ||
|
||
# resource "null_resource" "setup_leavers_redshift" { | ||
# depends_on = ["aws_redshift_cluster"] #wait for the db to be ready | ||
# provisioner "local-exec" { | ||
# command = "mysql -u ${aws_redshift_cluster.wepi_redshift_cluster.master_username} -p${aws_secretsmanager_secret_version.wepi_redshift_admin_pw.secret_string} < create_table_leavers.sql" | ||
# } | ||
# } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
200 changes: 10 additions & 190 deletions
200
terraform/environments/data-and-insights-wepi/json/wepi_iam_role_glue.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,193 +1,13 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:*", | ||
"s3-object-lambda:*", | ||
"glue:*", | ||
"s3:GetBucketLocation", | ||
"s3:ListBucket", | ||
"s3:ListAllMyBuckets", | ||
"s3:GetBucketAcl", | ||
"ec2:DescribeVpcEndpoints", | ||
"ec2:DescribeRouteTables", | ||
"ec2:CreateNetworkInterface", | ||
"ec2:DeleteNetworkInterface", | ||
"ec2:DescribeNetworkInterfaces", | ||
"ec2:DescribeSecurityGroups", | ||
"ec2:DescribeSubnets", | ||
"ec2:DescribeVpcAttribute", | ||
"iam:ListRolePolicies", | ||
"iam:GetRole", | ||
"iam:GetRolePolicy", | ||
"cloudwatch:PutMetricData" | ||
], | ||
"Resource": "*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:CreateBucket" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::aws-glue-*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject", | ||
"s3:PutObject", | ||
"s3:DeleteObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::aws-glue-*/*", | ||
"arn:aws:s3:::*/*aws-glue-*/*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject", | ||
"s3:PutObject", | ||
"s3:DeleteObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::aws-glue-*/*", | ||
"arn:aws:s3:::*/*aws-glue-*/*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::crawler-public*", | ||
"arn:aws:s3:::aws-glue-*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"logs:CreateLogGroup", | ||
"logs:CreateLogStream", | ||
"logs:PutLogEvents" | ||
], | ||
"Resource": [ | ||
"arn:aws:logs:*:*:/aws-glue/*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"ec2:CreateTags", | ||
"ec2:DeleteTags" | ||
], | ||
"Condition": { | ||
"ForAllValues:StringEquals": { | ||
"aws:TagKeys": [ | ||
"aws-glue-service-resource" | ||
] | ||
} | ||
"Action": "sts:AssumeRole", | ||
"Principal": { | ||
"Service": "glue.amazonaws.com" | ||
}, | ||
"Resource": [ | ||
"arn:aws:ec2:*:*:network-interface/*", | ||
"arn:aws:ec2:*:*:security-group/*", | ||
"arn:aws:ec2:*:*:instance/*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"glue:CreateDatabase", | ||
"glue:CreatePartition", | ||
"glue:CreateTable", | ||
"glue:DeleteDatabase", | ||
"glue:DeletePartition", | ||
"glue:DeleteTable", | ||
"glue:GetDatabase", | ||
"glue:GetDatabases", | ||
"glue:GetPartition", | ||
"glue:GetPartitions", | ||
"glue:GetTable", | ||
"glue:GetTableVersions", | ||
"glue:GetTables", | ||
"glue:UpdateDatabase", | ||
"glue:UpdatePartition", | ||
"glue:UpdateTable", | ||
"glue:CreateConnection", | ||
"glue:CreateJob", | ||
"glue:DeleteConnection", | ||
"glue:DeleteJob", | ||
"glue:GetConnection", | ||
"glue:GetConnections", | ||
"glue:GetDevEndpoint", | ||
"glue:GetDevEndpoints", | ||
"glue:GetJob", | ||
"glue:GetJobs", | ||
"glue:UpdateJob", | ||
"glue:BatchDeleteConnection", | ||
"glue:UpdateConnection", | ||
"glue:GetUserDefinedFunction", | ||
"glue:UpdateUserDefinedFunction", | ||
"glue:GetUserDefinedFunctions", | ||
"glue:DeleteUserDefinedFunction", | ||
"glue:CreateUserDefinedFunction", | ||
"glue:BatchGetPartition", | ||
"glue:BatchDeletePartition", | ||
"glue:BatchCreatePartition", | ||
"glue:BatchDeleteTable", | ||
"glue:UpdateDevEndpoint", | ||
"s3:GetBucketLocation", | ||
"s3:ListBucket", | ||
"s3:ListAllMyBuckets", | ||
"s3:GetBucketAcl" | ||
], | ||
"Resource": [ | ||
"*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:GetObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::crawler-public*", | ||
"arn:aws:s3:::aws-glue*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:PutObject", | ||
"s3:DeleteObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::aws-glue*" | ||
] | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"ec2:CreateTags", | ||
"ec2:DeleteTags" | ||
], | ||
"Condition": { | ||
"ForAllValues:StringEquals": { | ||
"aws:TagKeys": [ | ||
"aws-glue-service-resource" | ||
] | ||
} | ||
}, | ||
"Resource": [ | ||
"arn:aws:ec2:*:*:network-interface/*", | ||
"arn:aws:ec2:*:*:security-group/*", | ||
"arn:aws:ec2:*:*:instance/*" | ||
] | ||
} | ||
] | ||
} | ||
"Effect": "Allow", | ||
"Sid": "" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.