Skip to content

Commit

Permalink
feat!: Added publish functionality and bump AWS provider version to v5 (
Browse files Browse the repository at this point in the history
#57)

Co-authored-by: magreenbaum <magreenbaum>
  • Loading branch information
magreenbaum authored Oct 1, 2023
1 parent f74436b commit 28a77d2
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 9 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ module "step_function" {
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.6 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.66 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.6 |

## Modules

Expand Down Expand Up @@ -201,6 +201,7 @@ No modules.
| <a name="input_policy_json"></a> [policy\_json](#input\_policy\_json) | An additional policy document as JSON to attach to IAM role | `string` | `null` | no |
| <a name="input_policy_jsons"></a> [policy\_jsons](#input\_policy\_jsons) | List of additional policy documents as JSON to attach to IAM role | `list(string)` | `[]` | no |
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | Map of dynamic policy statements to attach to IAM role | `any` | `{}` | no |
| <a name="input_publish"></a> [publish](#input\_publish) | Determines whether to set a version of the state machine when it is created. | `bool` | `false` | no |
| <a name="input_role_arn"></a> [role\_arn](#input\_role\_arn) | The Amazon Resource Name (ARN) of the IAM role to use for this Step Function | `string` | `""` | no |
| <a name="input_role_description"></a> [role\_description](#input\_role\_description) | Description of IAM role to use for Step Function | `string` | `null` | no |
| <a name="input_role_force_detach_policies"></a> [role\_force\_detach\_policies](#input\_role\_force\_detach\_policies) | Specifies to force detaching any policies the IAM role has before destroying it. | `bool` | `true` | no |
Expand Down Expand Up @@ -228,6 +229,7 @@ No modules.
| <a name="output_state_machine_creation_date"></a> [state\_machine\_creation\_date](#output\_state\_machine\_creation\_date) | The date the Step Function was created |
| <a name="output_state_machine_id"></a> [state\_machine\_id](#output\_state\_machine\_id) | The ARN of the Step Function |
| <a name="output_state_machine_status"></a> [state\_machine\_status](#output\_state\_machine\_status) | The current status of the Step Function |
| <a name="output_state_machine_version_arn"></a> [state\_machine\_version\_arn](#output\_state\_machine\_version\_arn) | The ARN of state machine version |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

## Authors
Expand Down
5 changes: 3 additions & 2 deletions examples/complete/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ Note that this example may create resources which cost money. Run `terraform des
| Name | Version |
|------|---------|
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66 |
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.6 |
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2 |
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2 |

## Providers

| Name | Version |
|------|---------|
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.66 |
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 5.6 |
| <a name="provider_null"></a> [null](#provider\_null) | >= 2 |
| <a name="provider_random"></a> [random](#provider\_random) | >= 2 |

Expand Down Expand Up @@ -69,4 +69,5 @@ No inputs.
| <a name="output_state_machine_creation_date"></a> [state\_machine\_creation\_date](#output\_state\_machine\_creation\_date) | The date the State Machine was created |
| <a name="output_state_machine_id"></a> [state\_machine\_id](#output\_state\_machine\_id) | The ARN of the State Machine |
| <a name="output_state_machine_status"></a> [state\_machine\_status](#output\_state\_machine\_status) | The current status of the State Machine |
| <a name="output_state_machine_version_arn"></a> [state\_machine\_version\_arn](#output\_state\_machine\_version\_arn) | The ARN of state machine version |
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
2 changes: 1 addition & 1 deletion examples/complete/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ provider "aws" {
region = "eu-west-1"

# Make it faster by skipping something
skip_get_ec2_platforms = true
skip_metadata_api_check = true
skip_region_validation = true
skip_credentials_validation = true
Expand Down Expand Up @@ -38,6 +37,7 @@ module "step_function" {
type = "express"

definition = local.definition_template
publish = true

logging_configuration = {
include_execution_data = true
Expand Down
5 changes: 5 additions & 0 deletions examples/complete/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ output "state_machine_status" {
value = module.step_function.state_machine_status
}

output "state_machine_version_arn" {
description = "The ARN of state machine version"
value = module.step_function.state_machine_version_arn
}

# IAM Role
output "role_arn" {
description = "The ARN of the IAM role created for the State Machine"
Expand Down
15 changes: 12 additions & 3 deletions examples/complete/versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ terraform {
required_version = ">= 1.0"

required_providers {
aws = ">= 4.66"
random = ">= 2"
null = ">= 2"
aws = {
source = "hashicorp/aws"
version = ">= 5.6"
}
random = {
source = "hashicorp/random"
version = ">= 2"
}
null = {
source = "hashicorp/null"
version = ">= 2"
}
}
}
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ resource "aws_sfn_state_machine" "this" {

role_arn = var.use_existing_role ? var.role_arn : aws_iam_role.this[0].arn
definition = var.definition
publish = var.publish

dynamic "logging_configuration" {
for_each = local.enable_logging ? [true] : []
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ output "state_machine_status" {
value = try(aws_sfn_state_machine.this[0].status, "")
}

output "state_machine_version_arn" {
description = "The ARN of state machine version"
value = try(aws_sfn_state_machine.this[0].state_machine_version_arn, "")
}

# IAM Role
output "role_arn" {
description = "The ARN of the IAM role created for the Step Function"
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ variable "sfn_state_machine_timeouts" {
default = {}
}

variable "publish" {
description = "Determines whether to set a version of the state machine when it is created."
type = bool
default = false
}

#################
# CloudWatch Logs
#################
Expand Down
5 changes: 4 additions & 1 deletion versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ terraform {
required_version = ">= 1.0"

required_providers {
aws = ">= 4.66"
aws = {
source = "hashicorp/aws"
version = ">= 5.6"
}
}
}

0 comments on commit 28a77d2

Please sign in to comment.