Skip to content

Commit

Permalink
fix: Removed hard-coded AWS account id in examples (#275)
Browse files Browse the repository at this point in the history
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
  • Loading branch information
msharma24 and antonbabenko authored Mar 28, 2022
1 parent 295956f commit 5ab1383
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ provider "aws" {
skip_requesting_account_id = true
}

data "aws_caller_identity" "current" {}

####################################################
# Lambda Function (building locally, storing on S3,
# set allowed triggers, set policies)
Expand Down Expand Up @@ -52,15 +54,15 @@ module "lambda_function" {
allowed_triggers = {
APIGatewayAny = {
service = "apigateway"
source_arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/*/*/*"
source_arn = "arn:aws:execute-api:eu-west-1:${data.aws_caller_identity.current.account_id}:aqnku8akd0/*/*/*"
},
APIGatewayDevPost = {
service = "apigateway"
source_arn = "arn:aws:execute-api:eu-west-1:135367859851:aqnku8akd0/dev/POST/*"
source_arn = "arn:aws:execute-api:eu-west-1:${data.aws_caller_identity.current.account_id}:aqnku8akd0/dev/POST/*"
},
OneRule = {
principal = "events.amazonaws.com"
source_arn = "arn:aws:events:eu-west-1:135367859851:rule/RunDaily"
source_arn = "arn:aws:events:eu-west-1:${data.aws_caller_identity.current.account_id}:rule/RunDaily"
}
}

Expand All @@ -75,7 +77,7 @@ module "lambda_function" {
principals = {
account_principal = {
type = "AWS",
identifiers = ["arn:aws:iam::135367859851:root"]
identifiers = ["arn:aws:iam::${data.aws_caller_identity.current.account_id}:root"]
}
}
condition = {
Expand Down

0 comments on commit 5ab1383

Please sign in to comment.