Commit a0f19172 authored by Chris Merrett's avatar Chris Merrett

Fixed incorrect understanding of Terraforms application of IAM policies

parent 7ea5b6ed
Pipeline #957 passed with stage
in 7 seconds
...@@ -34,7 +34,7 @@ variable "cloudwatch_schedule" { ...@@ -34,7 +34,7 @@ variable "cloudwatch_schedule" {
############################################################################################################# #############################################################################################################
# IAM # IAM
############################################################################################################# #############################################################################################################
data "aws_iam_policy_document" "main" { data "aws_iam_policy_document" "policy" {
statement { statement {
effect = "Allow" effect = "Allow"
actions = [ actions = [
...@@ -70,9 +70,28 @@ data "aws_iam_policy_document" "main" { ...@@ -70,9 +70,28 @@ data "aws_iam_policy_document" "main" {
} }
} }
data "aws_iam_policy_document" "trust" {
statement {
effect = "Allow"
principals {
type = "Service"
identifiers = ["lambda.amazonaws.com"]
}
actions = [
"sts:AssumeRole",
]
}
}
resource "aws_iam_role_policy" "main" {
name = "lambda_ebs_snapshots"
role = "${aws_iam_role.main.id}"
policy = "${data.aws_iam_policy_document.policy.json}"
}
resource "aws_iam_role" "main" { resource "aws_iam_role" "main" {
name = "lambda_ebs_snapshots" name = "lambda_ebs_snapshots"
assume_role_policy = "${data.aws_iam_policy_document.main.json}" assume_role_policy = "${data.aws_iam_policy_document.trust.json}"
} }
############################################################################################################# #############################################################################################################
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment