data "aws_iam_policy_document" "for_ddns_lambda" {
statement {
effect = "Allow”
actions = ["ec2:Describe*"]
resources = ["*"]
}
statement {
effect = "Allow”
actions = ["dynamodb:*"]
resources = ["*"]
}
statement {
effect = "Allow”
actions = [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents”
]
resources = ["*"]
}
statement {
effect = "Allow”
actions = ["route53:*"]
resources = ["*"]
}
}
module "role_for_ddns_lambda" {
source = "./iam_role”
name = "role_for_ddns_lambda”
identifier = "lambda.amazonaws.com”
policy = data.aws_iam_policy_document.for_ddns_lambda.json
}
Lambda関数⽤IAM定義