Skip to content

Add support for Step Function type of either STANDARD (default) or EX… #2

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
merged 4 commits into from
Feb 12, 2021
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: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
.terraform
*.tfstate.backup
*.tfstate
*.tfvars
*.tfplan
terraform.tfstate
*.tfstate*
terraform.tfvars

builds/

__pycache__/
.terraform.lock.hcl
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ EOF
}
}

type = "STANDARD"

tags = {
Module = "my"
}
Expand Down Expand Up @@ -127,13 +129,13 @@ module "step_function" {
| Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.67 |
| aws | >= 3.27 |

## Providers

| Name | Version |
|------|---------|
| aws | >= 2.67 |
| aws | >= 3.27 |

## Inputs

Expand Down Expand Up @@ -167,6 +169,7 @@ module "step_function" {
| service\_integrations | Map of AWS service integrations to allow in IAM role policy | `any` | `{}` | no |
| tags | Maps of tags to assign to the Step Function | `map(string)` | `{}` | no |
| trusted\_entities | Step Function additional trusted entities for assuming roles (trust relationship) | `list(string)` | `[]` | no |
| type | Determines whether a Standard or Express state machine is created. The default is STANDARD. Valid Values: STANDARD \| EXPRESS | `string` | `"STANDARD"` | no |
| use\_existing\_role | Whether to use an existing IAM role for this Step Function | `bool` | `false` | no |

## Outputs
Expand Down
4 changes: 2 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| terraform | >= 0.12.6 |
| aws | >= 2.67 |
| aws | >= 3.27 |
| random | >= 2 |

## Providers

| Name | Version |
|------|---------|
| aws | >= 2.67 |
| aws | >= 3.27 |
| random | >= 2 |

## Inputs
Expand Down
2 changes: 2 additions & 0 deletions examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ module "step_function" {

name = random_pet.this.id

type = "express"

definition = local.definition_template

service_integrations = {
Expand Down
2 changes: 1 addition & 1 deletion examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_version = ">= 0.12.6"

required_providers {
aws = ">= 2.67"
aws = ">= 3.27"
random = ">= 2"
}
}
4 changes: 3 additions & 1 deletion main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
create_role = var.create && var.create_role && ! var.use_existing_role
create_role = var.create && var.create_role && !var.use_existing_role
aws_region = local.create_role && var.aws_region_assume_role == "" ? data.aws_region.current[0].name : var.aws_region_assume_role

role_name = local.create_role ? coalesce(var.role_name, var.name) : null
Expand All @@ -13,6 +13,8 @@ resource "aws_sfn_state_machine" "this" {
role_arn = var.use_existing_role ? var.role_arn : aws_iam_role.this[0].arn
definition = var.definition

type = upper(var.type)

tags = merge({ Name = var.name }, var.tags)
}

Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ variable "tags" {
default = {}
}

variable "type" {
description = "Determines whether a Standard or Express state machine is created. The default is STANDARD. Valid Values: STANDARD | EXPRESS"
type = string
default = "STANDARD"

validation {
condition = contains(["STANDARD", "EXPRESS"], upper(var.type))
error_message = "Step Function type must be one of the following (STANDARD | EXPRESS)."
}
}

###########
# IAM Role
###########
Expand Down
2 changes: 1 addition & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ terraform {
required_version = ">= 0.12.6"

required_providers {
aws = ">= 2.67"
aws = ">= 3.27"
}
}