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.
- Loading branch information
Showing
122 changed files
with
2,874 additions
and
982 deletions.
There are no files selected for viewing
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
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
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
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
35 changes: 35 additions & 0 deletions
35
terraform/environments/analytical-platform-compute/ec2-instances.tf
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,35 @@ | ||
module "debug_instance" { | ||
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions | ||
|
||
source = "terraform-aws-modules/ec2-instance/aws" | ||
version = "5.7.1" | ||
|
||
name = "network-debug" | ||
ami = "ami-0e8d228ad90af673b" # Ubuntu Server 24.04 LTS | ||
instance_type = "t3.micro" | ||
subnet_id = element(module.vpc.private_subnets, 0) | ||
vpc_security_group_ids = [module.debug_instance_security_group.security_group_id] | ||
associate_public_ip_address = false | ||
|
||
root_block_device = [ | ||
{ | ||
encrypted = true | ||
volume_type = "gp3" | ||
volume_size = 8 | ||
} | ||
] | ||
|
||
create_iam_instance_profile = true | ||
iam_role_policies = { | ||
SSMCore = "arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore" | ||
} | ||
|
||
metadata_options = { | ||
http_endpoint = "enabled" | ||
http_put_response_hop_limit = 1 | ||
http_tokens = "required" | ||
instance_metadata_tags = "enabled" | ||
} | ||
|
||
tags = local.tags | ||
} |
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
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
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
58 changes: 58 additions & 0 deletions
58
terraform/environments/analytical-platform-compute/lakeformation-permissions.tf
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,58 @@ | ||
|
||
resource "aws_lakeformation_lf_tag" "source" { | ||
count = terraform.workspace == "analytical-platform-compute-production" ? 1 : 0 | ||
key = "source" | ||
values = ["create-a-derived-table"] | ||
} | ||
|
||
resource "aws_lakeformation_permissions" "cadet_all_data" { | ||
for_each = (terraform.workspace == "analytical-platform-compute-production" ? | ||
toset(["TABLE", "DATABASE"]) : toset([])) | ||
|
||
principal = module.copy_apdp_cadet_metadata_to_compute_assumable_role.iam_role_arn | ||
permissions = ["ALL"] # https://docs.aws.amazon.com/lake-formation/latest/dg/lf-permissions-reference.html | ||
|
||
lf_tag_policy { | ||
resource_type = each.value | ||
expression { | ||
key = "source" | ||
values = ["create-a-derived-table"] | ||
} | ||
} | ||
} | ||
|
||
resource "aws_lakeformation_lf_tag" "domain" { | ||
for_each = try(local.environment_configuration.cadet_lf_tags, {}) | ||
key = each.key | ||
values = each.value | ||
} | ||
|
||
resource "aws_lakeformation_permissions" "cadet_domain_database_data" { | ||
for_each = try(local.environment_configuration.cadet_lf_tags, {}) | ||
|
||
principal = module.copy_apdp_cadet_metadata_to_compute_assumable_role.iam_role_arn | ||
permissions = ["ALL"] # https://docs.aws.amazon.com/lake-formation/latest/dg/lf-permissions-reference.html | ||
|
||
lf_tag_policy { | ||
resource_type = "DATABASE" | ||
expression { | ||
key = each.key | ||
values = each.value | ||
} | ||
} | ||
} | ||
|
||
resource "aws_lakeformation_permissions" "cadet_domain_table_data" { | ||
for_each = try(local.environment_configuration.cadet_lf_tags, {}) | ||
|
||
principal = module.copy_apdp_cadet_metadata_to_compute_assumable_role.iam_role_arn | ||
permissions = ["ALL"] # https://docs.aws.amazon.com/lake-formation/latest/dg/lf-permissions-reference.html | ||
|
||
lf_tag_policy { | ||
resource_type = "TABLE" | ||
expression { | ||
key = each.key | ||
values = each.value | ||
} | ||
} | ||
} |
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
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
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
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
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
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.