Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leftover import blocks #1302

Merged
merged 2 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions terraform/deployments/cluster-services/aws_auth_configmap.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,6 @@ resource "kubernetes_config_map" "aws_auth" {
}
}

import {
to = kubernetes_config_map.aws_auth
id = "kube-system/aws-auth"
}

resource "kubernetes_cluster_role_binding" "cluster_admins" {
metadata { name = "cluster-admins" }
role_ref {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,3 @@ resource "aws_s3_bucket_policy" "govuk_datagovuk_static_read_policy" {
bucket = aws_s3_bucket.datagovuk_static.id
policy = data.aws_iam_policy_document.datagovuk_static.json
}

// Imports (temporary)

import {
to = aws_s3_bucket.datagovuk_static
id = "datagovuk-${var.govuk_environment}-ckan-static-data"
}

import {
to = aws_s3_bucket_policy.govuk_datagovuk_static_read_policy
id = "datagovuk-${var.govuk_environment}-ckan-static-data"
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,3 @@ resource "aws_route53_record" "assets_efs" {
records = [aws_efs_file_system.assets_efs.dns_name]
ttl = 300
}

# Imports (temporary)

data "aws_efs_file_system" "assets_efs_import" {
tags = {
#The names aren't consistent across envs, but the description is for some reason
Description = "Asset Manager and Whitehall attachments are stored here temporarily for malware scanning before being transferred to S3."
}
}

import {
to = aws_efs_file_system.assets_efs
id = data.aws_efs_file_system.assets_efs_import.file_system_id
}

import {
to = aws_route53_record.assets_efs
id = "${data.aws_route53_zone.internal.zone_id}_assets.${data.aws_route53_zone.internal.name}_CNAME"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ resource "aws_iam_policy" "search_relevancy_bucket_access" {
description = "Allows reading and writing of the search relevancy bucket"
}

import {
to = aws_iam_policy.search_relevancy_bucket_access
id = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/govuk-${var.govuk_environment}-search-relevancy-bucket-access-policy"
}

resource "aws_iam_role_policy_attachment" "search_relevancy_s3_eks_policy_attachment" {
role = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.worker_iam_role_name
policy_arn = aws_iam_policy.search_relevancy_bucket_access.arn
Expand Down Expand Up @@ -66,11 +61,6 @@ resource "aws_iam_policy" "sitemaps_bucket_access" {
description = "Allows reading and writing of the sitemaps bucket"
}

import {
to = aws_iam_policy.sitemaps_bucket_access
id = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/govuk-${var.govuk_environment}-sitemaps-bucket-access-policy"
}

resource "aws_iam_role_policy_attachment" "sitemaps_s3_eks_policy_attachment" {
role = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.worker_iam_role_name
policy_arn = aws_iam_policy.sitemaps_bucket_access.arn
Expand All @@ -93,11 +83,6 @@ resource "aws_iam_policy" "use_sagemaker" {
description = "Allows invoking and describing SageMaker endpoints"
}

import {
to = aws_iam_policy.use_sagemaker
id = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:policy/govuk-${var.govuk_environment}-search-use-sagemaker-policy"
}

resource "aws_iam_role_policy_attachment" "search_api_sagemaker_attachment" {
role = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.worker_iam_role_name
policy_arn = aws_iam_policy.use_sagemaker.arn
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@ resource "aws_s3_bucket" "search_relevancy_bucket" {
bucket = "govuk-${var.govuk_environment}-search-relevancy"
}

import {
to = aws_s3_bucket.search_relevancy_bucket
id = "govuk-${var.govuk_environment}-search-relevancy"
}

resource "aws_s3_bucket_logging" "search_relevancy_bucket" {
bucket = aws_s3_bucket.search_relevancy_bucket.id

target_bucket = "govuk-${var.govuk_environment}-aws-logging"
target_prefix = "s3/govuk-${var.govuk_environment}-search-relevancy/"
}

import {
to = aws_s3_bucket_logging.search_relevancy_bucket
id = "govuk-${var.govuk_environment}-search-relevancy"
}

resource "aws_s3_bucket_lifecycle_configuration" "search_relevancy_bucket" {
bucket = aws_s3_bucket.search_relevancy_bucket.id

Expand All @@ -36,8 +26,3 @@ resource "aws_s3_bucket_lifecycle_configuration" "search_relevancy_bucket" {
expiration { days = 7 }
}
}

import {
to = aws_s3_bucket_lifecycle_configuration.search_relevancy_bucket
id = "govuk-${var.govuk_environment}-search-relevancy"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,12 @@ resource "aws_s3_bucket" "search_sitemaps_bucket" {
bucket = "govuk-${var.govuk_environment}-sitemaps"
}

import {
to = aws_s3_bucket.search_sitemaps_bucket
id = "govuk-${var.govuk_environment}-sitemaps"
}

resource "aws_s3_bucket_logging" "search_sitemaps_bucket" {
bucket = aws_s3_bucket.search_sitemaps_bucket.id
target_bucket = "govuk-${var.govuk_environment}-aws-logging"
target_prefix = "s3/govuk-${var.govuk_environment}-sitemaps/"
}

import {
to = aws_s3_bucket_logging.search_sitemaps_bucket
id = "govuk-${var.govuk_environment}-sitemaps"
}

resource "aws_s3_bucket_lifecycle_configuration" "search_sitemaps_bucket" {
bucket = aws_s3_bucket.search_sitemaps_bucket.id

Expand All @@ -29,8 +19,3 @@ resource "aws_s3_bucket_lifecycle_configuration" "search_sitemaps_bucket" {
}
}
}

import {
to = aws_s3_bucket_lifecycle_configuration.search_sitemaps_bucket
id = "govuk-${var.govuk_environment}-sitemaps"
}
17 changes: 2 additions & 15 deletions terraform/deployments/govuk-publishing-infrastructure/security.tf
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,9 @@ resource "aws_security_group_rule" "licensify_docdb_from_eks_workers" {
source_security_group_id = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id
}

# Remove once the content-data-api RDS instance has been migrated to govuk-infrastructure
resource "aws_security_group_rule" "postgres_from_eks_workers" {
for_each = merge(data.tfe_outputs.rds.nonsensitive_values.sg_rds, {
"transition_primary" = data.terraform_remote_state.infra_security_groups.outputs.sg_transition-postgresql-primary_id
"content_data_api" = data.terraform_remote_state.infra_security_groups.outputs.sg_content-data-api-postgresql-primary_id
})
for_each = { "content_data_api" = data.terraform_remote_state.infra_security_groups.outputs.sg_content-data-api-postgresql-primary_id }
description = "Database accepts requests from EKS nodes"
type = "ingress"
from_port = 5432
Expand All @@ -109,17 +107,6 @@ resource "aws_security_group_rule" "postgres_from_eks_workers" {
source_security_group_id = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id
}

resource "aws_security_group_rule" "mysql_from_eks_workers" {
for_each = data.tfe_outputs.rds.nonsensitive_values.sg_rds
description = "Database accepts requests from EKS nodes"
type = "ingress"
from_port = 3306
to_port = 3306
protocol = "tcp"
security_group_id = each.value
source_security_group_id = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id
}

resource "aws_security_group_rule" "elasticsearch_from_eks_workers" {
description = "ElasticSearch accepts requests from EKS nodes (for example Licence Finder queries ES directly)."
type = "ingress"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,3 @@ resource "aws_s3_bucket_logging" "whitehall_csvs" {
target_bucket = "govuk-${var.govuk_environment}-aws-logging"
target_prefix = "s3/govuk-${var.govuk_environment}-whitehall-csvs/"
}

import {
to = aws_s3_bucket.whitehall_csvs
id = "govuk-${var.govuk_environment}-whitehall-csvs"
}

import {
to = aws_s3_bucket_logging.whitehall_csvs
id = "govuk-${var.govuk_environment}-whitehall-csvs"
}
9 changes: 0 additions & 9 deletions terraform/deployments/rds/import_transition.tf

This file was deleted.

12 changes: 0 additions & 12 deletions terraform/deployments/rds/security_groups.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,3 @@ resource "aws_security_group_rule" "postgres" {
source_security_group_id = data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id

}

import {
for_each = { for name, data in var.databases : name => data if data.engine == "mysql" }
to = aws_security_group_rule.mysql[each.key]
id = "${aws_security_group.rds[each.key].id}_ingress_tcp_3306_3306_${data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id}"
}

import {
for_each = { for name, data in var.databases : name => data if data.engine == "postgres" }
to = aws_security_group_rule.postgres[each.key]
id = "${aws_security_group.rds[each.key].id}_ingress_tcp_5432_5432_${data.tfe_outputs.cluster_infrastructure.nonsensitive_values.node_security_group_id}"
}
5 changes: 0 additions & 5 deletions terraform/deployments/vpc/google_logging_bucket.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,3 @@ resource "google_storage_bucket_acl" "google_logging" {
"WRITER:group-cloud-storage-analytics@google.com",
]
}

import {
to = google_storage_bucket.google_logging
id = "govuk-${var.govuk_environment}-gcp-logging"
}
Loading