Skip to content

Commit 75871e9

Browse files
authored
local region (#26)
1 parent 6ab615e commit 75871e9

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

codebuild.tf

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ data "aws_iam_policy_document" "codebuild_assume" {
5757
test = "StringLike"
5858
variable = "aws:SourceArn"
5959
values = [
60-
"arn:aws:codebuild:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:project/${var.pipeline_name}-*"
60+
"arn:aws:codebuild:${local.region}:${data.aws_caller_identity.current.account_id}:project/${var.pipeline_name}-*"
6161
]
6262
}
6363
}
@@ -82,7 +82,7 @@ data "aws_iam_policy_document" "codebuild" {
8282
"logs:PutLogEvents"
8383
]
8484
resources = [
85-
"arn:aws:logs:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:*"
85+
"arn:aws:logs:${local.region}:${data.aws_caller_identity.current.account_id}:*"
8686
]
8787
}
8888

@@ -184,7 +184,7 @@ data "aws_iam_policy_document" "codebuild" {
184184

185185
]
186186
resources = [
187-
"arn:aws:ec2:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:network-interface/*"
187+
"arn:aws:ec2:${local.region}:${data.aws_caller_identity.current.account_id}:network-interface/*"
188188
]
189189
condition {
190190
test = "StringEquals"
@@ -198,7 +198,7 @@ data "aws_iam_policy_document" "codebuild" {
198198
variable = "ec2:Subnet"
199199
values = [
200200
for id in var.vpc["subnets"] :
201-
"arn:aws:ec2:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:subnet/${id}"
201+
"arn:aws:ec2:${local.region}:${data.aws_caller_identity.current.account_id}:subnet/${id}"
202202
]
203203
}
204204
}

codepipeline.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ data "aws_iam_policy_document" "codepipeline_assume" {
158158
test = "StringEquals"
159159
variable = "aws:SourceArn"
160160
values = [
161-
"arn:aws:codepipeline:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${var.pipeline_name}"
161+
"arn:aws:codepipeline:${local.region}:${data.aws_caller_identity.current.account_id}:${var.pipeline_name}"
162162
]
163163
}
164164
}
@@ -201,7 +201,7 @@ data "aws_iam_policy_document" "codepipeline" {
201201
"codestar-connections:UseConnection"
202202
]
203203
resources = [
204-
var.connection == null ? "arn:aws:codecommit:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${var.repo}" : var.connection
204+
var.connection == null ? "arn:aws:codecommit:${local.region}:${data.aws_caller_identity.current.account_id}:${var.repo}" : var.connection
205205
]
206206
}
207207

@@ -212,7 +212,7 @@ data "aws_iam_policy_document" "codepipeline" {
212212
"codebuild:StartBuild"
213213
]
214214
resources = [
215-
"arn:aws:codebuild:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:project/${var.pipeline_name}-*"
215+
"arn:aws:codebuild:${local.region}:${data.aws_caller_identity.current.account_id}:project/${var.pipeline_name}-*"
216216
]
217217
}
218218
}

eventbridge.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resource "aws_cloudwatch_event_rule" "this" {
1313
"CodeCommit Repository State Change"
1414
],
1515
"resources" : [
16-
"arn:aws:codecommit:${data.aws_region.current.name}:${data.aws_caller_identity.current.account_id}:${var.repo}"
16+
"arn:aws:codecommit:${local.region}:${data.aws_caller_identity.current.account_id}:${var.repo}"
1717
],
1818
"detail" : {
1919
"event" : [

locals.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ locals {
2424
TAGS = var.tags
2525
TAGNAG_VERSION = var.tagnag_version
2626
})
27+
28+
region = data.aws_region.current.name
2729
}

0 commit comments

Comments
 (0)