diff --git a/.gitignore b/.gitignore index 0308fbf..64ba6a7 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ .terraform -*.tfstate.backup -*.tfstate -*.tfvars -*.tfplan +terraform.tfstate +*.tfstate* +terraform.tfvars -builds/ - -__pycache__/ +.terraform.lock.hcl diff --git a/README.md b/README.md index 4755366..7c1e797 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ EOF } } + type = "STANDARD" + tags = { Module = "my" } @@ -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 @@ -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 diff --git a/examples/complete/README.md b/examples/complete/README.md index daf9fb8..8b684dd 100644 --- a/examples/complete/README.md +++ b/examples/complete/README.md @@ -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 diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 81448da..317c1f1 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -36,6 +36,8 @@ module "step_function" { name = random_pet.this.id + type = "express" + definition = local.definition_template service_integrations = { diff --git a/examples/complete/versions.tf b/examples/complete/versions.tf index 1698397..b4c51dd 100644 --- a/examples/complete/versions.tf +++ b/examples/complete/versions.tf @@ -2,7 +2,7 @@ terraform { required_version = ">= 0.12.6" required_providers { - aws = ">= 2.67" + aws = ">= 3.27" random = ">= 2" } } diff --git a/main.tf b/main.tf index 368358a..404415a 100644 --- a/main.tf +++ b/main.tf @@ -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 @@ -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) } diff --git a/variables.tf b/variables.tf index 28364ec..4339a2e 100644 --- a/variables.tf +++ b/variables.tf @@ -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 ########### diff --git a/versions.tf b/versions.tf index 0d66101..d3da6c9 100644 --- a/versions.tf +++ b/versions.tf @@ -2,6 +2,6 @@ terraform { required_version = ">= 0.12.6" required_providers { - aws = ">= 2.67" + aws = ">= 3.27" } }