Skip to content

Commit bdd3276

Browse files
[PRM-599] Upgrade aws provider to v6 (#92)
* [PRM-599] upgrade terraform aws provider to ~>6.0 * [PRM-599] newline * [PRM-599] update from .name to .region * [PRM-599] update all instances from .name to .region * [PRM-599] remove unnecessary provider and added hard coded value. * [PRM-599] remove unnecessary provider and added hard coded value.
1 parent 48f45a1 commit bdd3276

40 files changed

Lines changed: 98 additions & 103 deletions

File tree

stacks/base-networking/terraform/gateway-endpoint.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
resource "aws_vpc_endpoint" "s3" {
22
vpc_id = aws_vpc.vpc.id
3-
service_name = "com.amazonaws.${data.aws_region.current.name}.s3"
3+
service_name = "com.amazonaws.${data.aws_region.current.region}.s3"
44

55
tags = merge(
66
local.common_tags,

stacks/base-networking/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.0"
5+
version = "~> 6.0"
66
}
77
}
88
}

stacks/base-support/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.0"
5+
version = "~> 6.0"
66
}
77
}
88
}

stacks/container-repositories/terraform/provider.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.0"
5+
version = "~> 6.0"
66
}
77
}
88
}
99

1010
provider "aws" {
1111
region = "eu-west-2"
12-
}
12+
}

stacks/ecs-cluster/terraform/ecs-cluster.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ resource "aws_iam_policy" "ecs_execution" {
5656
}
5757

5858
locals {
59-
ecr_arn_prefix = "arn:aws:ecr:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}"
59+
ecr_arn_prefix = "arn:aws:ecr:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}"
6060
}
6161

6262
data "aws_region" "current" {}

stacks/ecs-cluster/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.0"
5+
version = "~> 6.0"
66
}
77
}
88
}

stacks/email-and-alerting/terraform/gp2gp-dashboard-alert-lambda.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ resource "aws_lambda_function" "gp2gp_dashboard_alert_lambda" {
2121
environment {
2222
variables = {
2323
LOG_ALERTS_GENERAL_WEBHOOK_URL_PARAM_NAME = var.log_alerts_general_webhook_url_param_name,
24-
GP2GP_DASHBOARD_STEP_FUNCTION_URL = "https://${data.aws_region.current.name}.console.aws.amazon.com/states/home#/statemachines/view/arn:aws:states:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:stateMachine:dashboard-pipeline",
24+
GP2GP_DASHBOARD_STEP_FUNCTION_URL = "https://${data.aws_region.current.region}.console.aws.amazon.com/states/home#/statemachines/view/arn:aws:states:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:stateMachine:dashboard-pipeline",
2525
GP2GP_DASHBOARD_NATIONAL_STATISTICS_URL = var.gp2gp_dashboard_national_statistics_url,
2626
ENVIRONMENT = var.environment,
2727
}

stacks/email-and-alerting/terraform/iam.tf

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@ data "aws_iam_policy_document" "email_report_lambda_ssm_access" {
6262
]
6363

6464
resources = [
65-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_sender_email_param_name}",
66-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_recipient_email_param_name}",
67-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_recipient_internal_email_param_name}",
68-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_sender_email_key_param_name}",
65+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_sender_email_param_name}",
66+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_recipient_email_param_name}",
67+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_recipient_internal_email_param_name}",
68+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.email_report_sender_email_key_param_name}",
6969
]
7070
}
7171
}
@@ -128,7 +128,7 @@ data "aws_iam_policy_document" "email_report_send_raw_email" {
128128
]
129129

130130
resources = [
131-
"arn:aws:ses:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:identity/${data.aws_ssm_parameter.email_report_sender_email.value}",
131+
"arn:aws:ses:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:identity/${data.aws_ssm_parameter.email_report_sender_email.value}",
132132
]
133133
}
134134
}
@@ -200,10 +200,10 @@ data "aws_iam_policy_document" "log_alerts_ssm_access" {
200200
]
201201

202202
resources = [
203-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_webhook_url_param_name}",
204-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_above_threshold_webhook_url_param_name}",
205-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_general_webhook_url_param_name}",
206-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_above_threshold_rate_param_name}"
203+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_webhook_url_param_name}",
204+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_above_threshold_webhook_url_param_name}",
205+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_general_webhook_url_param_name}",
206+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter${var.log_alerts_technical_failures_above_threshold_rate_param_name}"
207207
]
208208
}
209209
}
@@ -324,8 +324,8 @@ data "aws_iam_policy_document" "store_asid_lookup_lambda_access" {
324324
"ssm:GetParameter"
325325
]
326326
resources = [
327-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/registrations/${var.environment}/data-pipeline/gp2gp-dashboard/permitted-emails",
328-
"arn:aws:ssm:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:parameter/registrations/${var.environment}/data-pipeline/gp2gp-dashboard/email-storage-bucket-name"
327+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter/registrations/${var.environment}/data-pipeline/gp2gp-dashboard/permitted-emails",
328+
"arn:aws:ssm:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:parameter/registrations/${var.environment}/data-pipeline/gp2gp-dashboard/email-storage-bucket-name"
329329
]
330330
}
331331

@@ -342,7 +342,7 @@ data "aws_iam_policy_document" "store_asid_lookup_lambda_access" {
342342
actions = [
343343
"states:StartExecution"
344344
]
345-
resources = ["arn:aws:states:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:stateMachine:ods-downloader-pipeline"]
345+
resources = ["arn:aws:states:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:stateMachine:ods-downloader-pipeline"]
346346
}
347347
}
348348

stacks/email-and-alerting/terraform/log-alerts-lambda.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ resource "aws_lambda_permission" "log_alerts_technical_failures_above_threshold_
3333
statement_id = "log-alerts-technical-failures-above-threshold-lambda-allow-cloudwatch"
3434
action = "lambda:InvokeFunction"
3535
function_name = aws_lambda_function.log_alerts_technical_failures_above_threshold_lambda.function_name
36-
principal = "logs.${data.aws_region.current.name}.amazonaws.com"
37-
source_arn = "arn:aws:logs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:log-group:${data.aws_ssm_parameter.cloud_watch_log_group.value}:*"
36+
principal = "logs.${data.aws_region.current.region}.amazonaws.com"
37+
source_arn = "arn:aws:logs:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:log-group:${data.aws_ssm_parameter.cloud_watch_log_group.value}:*"
3838
}
3939

4040
resource "aws_cloudwatch_log_subscription_filter" "log_alerts_technical_failures_above_threshold" {
@@ -79,8 +79,8 @@ resource "aws_lambda_permission" "log_alerts_pipeline_error_lambda_allow_cloudwa
7979
statement_id = "log-alerts-pipeline-error-lambda-allow-cloudwatch"
8080
action = "lambda:InvokeFunction"
8181
function_name = aws_lambda_function.log_alerts_pipeline_error_lambda.function_name
82-
principal = "logs.${data.aws_region.current.name}.amazonaws.com"
83-
source_arn = "arn:aws:logs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:log-group:${data.aws_ssm_parameter.cloud_watch_log_group.value}:*"
82+
principal = "logs.${data.aws_region.current.region}.amazonaws.com"
83+
source_arn = "arn:aws:logs:${data.aws_region.current.region}:${data.aws_caller_identity.current.account_id}:log-group:${data.aws_ssm_parameter.cloud_watch_log_group.value}:*"
8484
}
8585

8686
resource "aws_cloudwatch_log_subscription_filter" "log_alerts_pipeline_error" {

stacks/email-and-alerting/terraform/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ terraform {
22
required_providers {
33
aws = {
44
source = "hashicorp/aws"
5-
version = "~> 5.0"
5+
version = "~> 6.0"
66
}
77
}
88
}

0 commit comments

Comments
 (0)