Skip to content

Commit 5ab1383

Browse files
fix: Removed hard-coded AWS account id in examples (#275)
Co-authored-by: Anton Babenko <[email protected]>
1 parent 295956f commit 5ab1383

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

examples/complete/main.tf

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ provider "aws" {
99
skip_requesting_account_id = true
1010
}
1111

12+
data "aws_caller_identity" "current" {}
13+
1214
####################################################
1315
# Lambda Function (building locally, storing on S3,
1416
# set allowed triggers, set policies)
@@ -52,15 +54,15 @@ module "lambda_function" {
5254
allowed_triggers = {
5355
APIGatewayAny = {
5456
service = "apigateway"
55-
source_arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/*/*/*"
57+
source_arn = "arn:aws:execute-api:eu-west-1:${data.aws_caller_identity.current.account_id}:aqnku8akd0/*/*/*"
5658
},
5759
APIGatewayDevPost = {
5860
service = "apigateway"
59-
source_arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/dev/POST/*"
61+
source_arn = "arn:aws:execute-api:eu-west-1:${data.aws_caller_identity.current.account_id}:aqnku8akd0/dev/POST/*"
6062
},
6163
OneRule = {
6264
principal = "events.amazonaws.com"
63-
source_arn = "arn:aws:events:eu-west-1:135367859851:rule/RunDaily"
65+
source_arn = "arn:aws:events:eu-west-1:${data.aws_caller_identity.current.account_id}:rule/RunDaily"
6466
}
6567
}
6668

@@ -75,7 +77,7 @@ module "lambda_function" {
7577
principals = {
7678
account_principal = {
7779
type = "AWS",
78-
identifiers = ["arn:aws:iam::135367859851:root"]
80+
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
7981
}
8082
}
8183
condition = {

0 commit comments

Comments
 (0)