Skip to content

Commit

Permalink
Fix formatting to shut the linter up
Browse files Browse the repository at this point in the history
  • Loading branch information
samsimpson1 committed Mar 6, 2024
1 parent 405b225 commit 1d00236
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion terraform/projects/app-transition-postgresql/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module "transition-postgresql-primary_rds_instance" {
name = "${var.stackname}-transition-postgresql-primary"
engine_name = "postgres"
engine_version = "13"
default_tags = "${map("Project", var.stackname, "aws_stackname", var.stackname, "aws_environment", var.aws_environment, "aws_migration", "transition_postgresql_primary")}"
default_tags = map("Project", var.stackname, "aws_stackname", var.stackname, "aws_environment", var.aws_environment, "aws_migration", "transition_postgresql_primary")
subnet_ids = data.terraform_remote_state.infra_networking.private_subnet_rds_ids
username = var.username
password = var.password
Expand Down
82 changes: 41 additions & 41 deletions terraform/projects/infra-fastly-logs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@
* Manages the Fastly logging data which is sent from Fastly to S3.
*/
variable "aws_region" {
type = "string"
type = string
description = "AWS region"
default = "eu-west-1"
}

variable "aws_environment" {
type = "string"
type = string
description = "AWS Environment"
}

variable "stackname" {
type = "string"
type = string
description = "Stackname"
}

Expand All @@ -27,7 +27,7 @@ terraform {
}

provider "aws" {
region = "${var.aws_region}"
region = var.aws_region
version = "5.21.0"
}

Expand All @@ -45,7 +45,7 @@ resource "aws_s3_bucket" "fastly_logs" {
}

logging {
target_bucket = "${data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id}"
target_bucket = data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id
target_prefix = "s3/govuk-${var.aws_environment}-fastly-logs/"
}

Expand All @@ -65,18 +65,18 @@ resource "aws_iam_user" "logs_writer" {

resource "aws_iam_policy" "logs_writer" {
name = "fastly-logs-${var.aws_environment}-logs-writer-policy"
policy = "${data.template_file.logs_writer_policy_template.rendered}"
policy = data.template_file.logs_writer_policy_template.rendered
description = "Allows writing to to the fastly-logs bucket"
}

resource "aws_iam_policy_attachment" "logs_writer" {
name = "logs-writer-policy-attachment"
users = ["${aws_iam_user.logs_writer.name}"]
policy_arn = "${aws_iam_policy.logs_writer.arn}"
policy_arn = aws_iam_policy.logs_writer.arn
}

data "template_file" "logs_writer_policy_template" {
template = "${file("${path.module}/../../policies/fastly_logs_writer_policy.tpl")}"
template = file("${path.module}/../../policies/fastly_logs_writer_policy.tpl")

vars = {
aws_environment = "${var.aws_environment}"
Expand All @@ -91,7 +91,7 @@ resource "aws_glue_catalog_database" "fastly_logs" {

resource "aws_iam_role_policy_attachment" "aws-glue-service-role-service-attachment" {
policy_arn = "arn:aws:iam::aws:policy/service-role/AWSGlueServiceRole"
role = "${aws_iam_role.glue.name}"
role = aws_iam_role.glue.name
}

resource "aws_iam_role" "glue" {
Expand All @@ -118,7 +118,7 @@ EOF

resource "aws_iam_role_policy" "fastly_logs_policy" {
name = "govuk-${var.aws_environment}-fastly-logs-glue-policy"
role = "${aws_iam_role.glue.id}"
role = aws_iam_role.glue.id

policy = <<EOF
{
Expand All @@ -142,8 +142,8 @@ EOF
resource "aws_glue_crawler" "govuk_www" {
name = "GOV.UK fastly logs"
description = "Crawls the GOV.UK logs from fastly for allowing Athena querying"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
role = "${aws_iam_role.glue.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
role = aws_iam_role.glue.name
schedule = "cron(30 */4 * * ? *)"

s3_target {
Expand All @@ -170,7 +170,7 @@ EOF
resource "aws_glue_catalog_table" "govuk_www" {
name = "govuk_www"
description = "Allows access to JSON data exported from Fastly"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
table_type = "EXTERNAL_TABLE"

storage_descriptor {
Expand Down Expand Up @@ -336,8 +336,8 @@ resource "aws_glue_catalog_table" "govuk_www" {
resource "aws_glue_crawler" "govuk_assets" {
name = "Assets fastly logs"
description = "Crawls the assets logs from fastly for allowing Athena querying"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
role = "${aws_iam_role.glue.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
role = aws_iam_role.glue.name
schedule = "cron(30 */4 * * ? *)"

s3_target {
Expand All @@ -364,7 +364,7 @@ EOF
resource "aws_glue_catalog_table" "govuk_assets" {
name = "govuk_assets"
description = "Allows access to JSON data exported from Fastly"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
table_type = "EXTERNAL_TABLE"

storage_descriptor {
Expand Down Expand Up @@ -530,8 +530,8 @@ resource "aws_glue_catalog_table" "govuk_assets" {
resource "aws_glue_crawler" "bouncer" {
name = "Bouncer fastly logs"
description = "Crawls the bouncer logs from fastly for allowing Athena querying"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
role = "${aws_iam_role.glue.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
role = aws_iam_role.glue.name
schedule = "cron(30 */4 * * ? *)"

s3_target {
Expand All @@ -558,7 +558,7 @@ EOF
resource "aws_glue_catalog_table" "bouncer" {
name = "bouncer"
description = "Allows access to JSON data exported from Fastly"
database_name = "${aws_glue_catalog_database.fastly_logs.name}"
database_name = aws_glue_catalog_database.fastly_logs.name
table_type = "EXTERNAL_TABLE"

storage_descriptor {
Expand Down Expand Up @@ -707,7 +707,7 @@ resource "aws_s3_bucket" "fastly_logs_monitoring" {
}

logging {
target_bucket = "${data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id}"
target_bucket = data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id
target_prefix = "s3/govuk-${var.aws_environment}-fastly-logs-monitoring/"
}

Expand All @@ -726,17 +726,17 @@ resource "aws_iam_user" "athena_monitoring" {

resource "aws_iam_policy" "athena_monitoring" {
name = "fastly-logs-${var.aws_environment}-fastly-logs-athena-monitoring-policy"
policy = "${data.template_file.athena_monitoring_policy_template.rendered}"
policy = data.template_file.athena_monitoring_policy_template.rendered
}

resource "aws_iam_policy_attachment" "athena_monitoring" {
name = "fastly-logs-${var.aws_environment}-fastly-logs-athena-monitoring-policy-attachment"
users = ["${aws_iam_user.athena_monitoring.name}"]
policy_arn = "${aws_iam_policy.athena_monitoring.arn}"
policy_arn = aws_iam_policy.athena_monitoring.arn
}

data "template_file" "athena_monitoring_policy_template" {
template = "${file("${path.module}/../../policies/fastly_logs_athena_monitoring_policy.tpl")}"
template = file("${path.module}/../../policies/fastly_logs_athena_monitoring_policy.tpl")

vars = {
out_bucket_arn = "${aws_s3_bucket.fastly_logs_monitoring.arn}"
Expand All @@ -756,7 +756,7 @@ resource "aws_s3_bucket" "transition_fastly_logs" {
}

logging {
target_bucket = "${data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id}"
target_bucket = data.terraform_remote_state.infra_monitoring.outputs.aws_logging_bucket_id
target_prefix = "s3/govuk-${var.aws_environment}-transition-fastly-logs/"
}

Expand All @@ -776,17 +776,17 @@ resource "aws_iam_user" "transition_downloader" {

resource "aws_iam_policy" "transition_downloader" {
name = "fastly-logs-${var.aws_environment}-transition-downloader-policy"
policy = "${data.template_file.transition_downloader_policy_template.rendered}"
policy = data.template_file.transition_downloader_policy_template.rendered
}

resource "aws_iam_policy_attachment" "transition_downloader" {
name = "transition-downloader-policy-attachment"
users = ["${aws_iam_user.transition_downloader.name}"]
policy_arn = "${aws_iam_policy.transition_downloader.arn}"
policy_arn = aws_iam_policy.transition_downloader.arn
}

data "template_file" "transition_downloader_policy_template" {
template = "${file("${path.module}/../../policies/transition_downloader_policy.tpl")}"
template = file("${path.module}/../../policies/transition_downloader_policy.tpl")

vars = {
bucket_arn = "${aws_s3_bucket.transition_fastly_logs.arn}"
Expand All @@ -795,8 +795,8 @@ data "template_file" "transition_downloader_policy_template" {

resource "aws_athena_named_query" "transition_logs" {
name = "transition-logs-query"
database = "${aws_glue_catalog_database.fastly_logs.name}"
query = "${file("${path.module}/../../queries/transition_logs_query.sql")}"
database = aws_glue_catalog_database.fastly_logs.name
query = file("${path.module}/../../queries/transition_logs_query.sql")
}

data "archive_file" "transition_executor" {
Expand All @@ -806,11 +806,11 @@ data "archive_file" "transition_executor" {
}

resource "aws_lambda_function" "transition_executor" {
filename = "${data.archive_file.transition_executor.output_path}"
source_code_hash = "${data.archive_file.transition_executor.output_base64sha256}"
filename = data.archive_file.transition_executor.output_path
source_code_hash = data.archive_file.transition_executor.output_base64sha256

function_name = "govuk-${var.aws_environment}-transition"
role = "${aws_iam_role.transition_executor.arn}"
role = aws_iam_role.transition_executor.arn
handler = "main.lambda_handler"
runtime = "python3.8"

Expand Down Expand Up @@ -845,16 +845,16 @@ EOF

resource "aws_iam_policy" "transition_executor" {
name = "fastly-logs-${var.aws_environment}-transition-executor-policy"
policy = "${data.template_file.transition_executor_policy_template.rendered}"
policy = data.template_file.transition_executor_policy_template.rendered
}

resource "aws_iam_role_policy_attachment" "transition_executor" {
role = "${aws_iam_role.transition_executor.name}"
policy_arn = "${aws_iam_policy.transition_executor.arn}"
role = aws_iam_role.transition_executor.name
policy_arn = aws_iam_policy.transition_executor.arn
}

data "template_file" "transition_executor_policy_template" {
template = "${file("${path.module}/../../policies/transition_executor_policy.tpl")}"
template = file("${path.module}/../../policies/transition_executor_policy.tpl")

vars = {
out_bucket_arn = "${aws_s3_bucket.transition_fastly_logs.arn}"
Expand All @@ -868,22 +868,22 @@ resource "aws_cloudwatch_event_rule" "transition_executor_daily" {
}

resource "aws_cloudwatch_event_target" "transition_executor_daily" {
rule = "${aws_cloudwatch_event_rule.transition_executor_daily.name}"
arn = "${aws_lambda_function.transition_executor.arn}"
rule = aws_cloudwatch_event_rule.transition_executor_daily.name
arn = aws_lambda_function.transition_executor.arn
}

resource "aws_lambda_permission" "cloudwatch_transition_executor_daily_permission" {
statement_id = "AllowExecutionFromCloudWatch"
action = "lambda:InvokeFunction"
function_name = "${aws_lambda_function.transition_executor.function_name}"
function_name = aws_lambda_function.transition_executor.function_name
principal = "events.amazonaws.com"
source_arn = "${aws_cloudwatch_event_rule.transition_executor_daily.arn}"
source_arn = aws_cloudwatch_event_rule.transition_executor_daily.arn
}

# Outputs
# --------------------------------------------------------------

output "logs_writer_bucket_policy_arn" {
value = "${aws_iam_policy.logs_writer.arn}"
value = aws_iam_policy.logs_writer.arn
description = "ARN of the logs writer bucket policy"
}
4 changes: 2 additions & 2 deletions terraform/projects/infra-public-services/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ module "ckan_public_lb" {
subnets = data.terraform_remote_state.infra_networking.outputs.public_subnet_ids
security_groups = ["${data.terraform_remote_state.infra_security_groups.outputs.sg_ckan_elb_external_id}"]
alarm_actions = ["${data.terraform_remote_state.infra_monitoring.outputs.sns_topic_cloudwatch_alarms_arn}"]
default_tags = "${map("Project", var.stackname, "aws_migration", "ckan", "aws_environment", var.aws_environment)}"
default_tags = map("Project", var.stackname, "aws_migration", "ckan", "aws_environment", var.aws_environment)
}

resource "aws_route53_record" "ckan_public_service_names" {
Expand Down Expand Up @@ -660,7 +660,7 @@ resource "aws_elb" "jumpbox_public_elb" {
connection_draining = true
connection_draining_timeout = 400

tags = "${map("Name", "${var.stackname}-jumpbox", "Project", var.stackname, "aws_environment", var.aws_environment, "aws_migration", "jumpbox")}"
tags = map("Name", "${var.stackname}-jumpbox", "Project", var.stackname, "aws_environment", var.aws_environment, "aws_migration", "jumpbox")
}

resource "aws_route53_record" "jumpbox_public_service_names" {
Expand Down
2 changes: 1 addition & 1 deletion terraform/projects/infra-vpc/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ data "terraform_remote_state" "infra_monitoring" {

module "vpc" {
source = "../../modules/aws/network/vpc"
default_tags = "${map("Project", var.stackname)}"
default_tags = map("Project", var.stackname)
name = var.vpc_name
cidr = var.vpc_cidr
}
Expand Down

0 comments on commit 1d00236

Please sign in to comment.