Skip to content

feat: Added default resources for events permissions #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ EOF
lambda = {
lambda = ["arn:aws:lambda:eu-west-1:123456789012:function:test1", "arn:aws:lambda:eu-west-1:123456789012:function:test2"]
}

stepfunction_Sync = {
stepfunction = ["arn:aws:states:eu-west-1:123456789012:stateMachine:test1"]
stepfunction_Wildcard = ["arn:aws:states:eu-west-1:123456789012:stateMachine:test1"]

# Set to true to use the default events (otherwise, set this to a list of ARNs; see the docs linked in locals.tf
# for more information). Without events permissions, you will get an error similar to this:
# Error: AccessDeniedException: 'arn:aws:iam::xxxx:role/step-functions-role' is not authorized to
# create managed-rule
events = true
}
}

type = "STANDARD"
Expand Down
11 changes: 11 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,17 @@ module "step_function" {
xray = true
}

stepfunction_Sync = {
stepfunction = ["arn:aws:states:eu-west-1:123456789012:stateMachine:test1"]
stepfunction_Wildcard = ["arn:aws:states:eu-west-1:123456789012:stateMachine:test1"]

# Set to true to use the default events (otherwise, set this to a list of ARNs; see the docs linked in locals.tf
# for more information). Without events permissions, you will get an error similar to this:
# Error: AccessDeniedException: 'arn:aws:iam::xxxx:role/step-functions-role' is not authorized to
# create managed-rule
events = true
}

# # NB: This will "Deny" everything (including logging)!
# no_tasks = {
# deny_all = true
Expand Down
11 changes: 11 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ locals {
"events:DescribeRule"
]
}
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventsForBatchJobsRule"]
}

batch_WaitForTaskToken = {
Expand Down Expand Up @@ -269,6 +270,7 @@ locals {
"events:PutRule",
"events:DescribeRule"
]
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventsForECSTaskRule"]
}
}

Expand Down Expand Up @@ -352,6 +354,7 @@ locals {
"events:DescribeRule"
]
}
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventsForSageMakerTrainingJobsRule"]
}

sagemaker_CreateTrainingJob_WaitForTaskToken = {
Expand Down Expand Up @@ -417,6 +420,7 @@ locals {
"events:PutRule",
"events:DescribeRule"
]
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventsForSageMakerTransformJobsRule"]
}
}

Expand Down Expand Up @@ -464,6 +468,7 @@ locals {
"events:PutRule",
"events:DescribeRule"
]
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventForEMRAddJobFlowStepsRule"]
}
}

Expand Down Expand Up @@ -497,6 +502,7 @@ locals {
"events:PutRule",
"events:DescribeRule"
]
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventForEMRRunJobFlowRule"]
}
}

Expand Down Expand Up @@ -541,6 +547,7 @@ locals {
"events:DescribeRule"
]
}
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventForEMRTerminateJobFlowsRule"]
}

# https://docs.aws.amazon.com/step-functions/latest/dg/codebuild-iam.html
Expand All @@ -560,6 +567,7 @@ locals {
"events:DescribeRule"
]
}
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventForCodeBuildStartBuildRule"]
}

codebuild_StartBuild = {
Expand Down Expand Up @@ -711,6 +719,7 @@ locals {
"events:PutRule",
"events:DescribeRule"
]
default_resources = ["arn:aws:events:${local.aws_region}:${data.aws_caller_identity.current.account_id}:rule/StepFunctionsGetEventsForStepFunctionsExecutionRule"]
}
}

Expand Down Expand Up @@ -743,3 +752,5 @@ locals {

}
}

data "aws_caller_identity" "current" {}