Skip to content

Commit 28a77d2

Browse files
authored
feat!: Added publish functionality and bump AWS provider version to v5 (#57)
Co-authored-by: magreenbaum <magreenbaum>
1 parent f74436b commit 28a77d2

File tree

9 files changed

+41
-9
lines changed

9 files changed

+41
-9
lines changed

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ module "step_function" {
134134
| Name | Version |
135135
|------|---------|
136136
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
137-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66 |
137+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.6 |
138138

139139
## Providers
140140

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

145145
## Modules
146146

@@ -201,6 +201,7 @@ No modules.
201201
| <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 |
202202
| <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 |
203203
| <a name="input_policy_statements"></a> [policy\_statements](#input\_policy\_statements) | Map of dynamic policy statements to attach to IAM role | `any` | `{}` | no |
204+
| <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 |
204205
| <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 |
205206
| <a name="input_role_description"></a> [role\_description](#input\_role\_description) | Description of IAM role to use for Step Function | `string` | `null` | no |
206207
| <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 |
@@ -228,6 +229,7 @@ No modules.
228229
| <a name="output_state_machine_creation_date"></a> [state\_machine\_creation\_date](#output\_state\_machine\_creation\_date) | The date the Step Function was created |
229230
| <a name="output_state_machine_id"></a> [state\_machine\_id](#output\_state\_machine\_id) | The ARN of the Step Function |
230231
| <a name="output_state_machine_status"></a> [state\_machine\_status](#output\_state\_machine\_status) | The current status of the Step Function |
232+
| <a name="output_state_machine_version_arn"></a> [state\_machine\_version\_arn](#output\_state\_machine\_version\_arn) | The ARN of state machine version |
231233
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
232234

233235
## Authors

examples/complete/README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ Note that this example may create resources which cost money. Run `terraform des
2323
| Name | Version |
2424
|------|---------|
2525
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 1.0 |
26-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.66 |
26+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 5.6 |
2727
| <a name="requirement_null"></a> [null](#requirement\_null) | >= 2 |
2828
| <a name="requirement_random"></a> [random](#requirement\_random) | >= 2 |
2929

3030
## Providers
3131

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

@@ -69,4 +69,5 @@ No inputs.
6969
| <a name="output_state_machine_creation_date"></a> [state\_machine\_creation\_date](#output\_state\_machine\_creation\_date) | The date the State Machine was created |
7070
| <a name="output_state_machine_id"></a> [state\_machine\_id](#output\_state\_machine\_id) | The ARN of the State Machine |
7171
| <a name="output_state_machine_status"></a> [state\_machine\_status](#output\_state\_machine\_status) | The current status of the State Machine |
72+
| <a name="output_state_machine_version_arn"></a> [state\_machine\_version\_arn](#output\_state\_machine\_version\_arn) | The ARN of state machine version |
7273
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->

examples/complete/main.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ provider "aws" {
22
region = "eu-west-1"
33

44
# Make it faster by skipping something
5-
skip_get_ec2_platforms = true
65
skip_metadata_api_check = true
76
skip_region_validation = true
87
skip_credentials_validation = true
@@ -38,6 +37,7 @@ module "step_function" {
3837
type = "express"
3938

4039
definition = local.definition_template
40+
publish = true
4141

4242
logging_configuration = {
4343
include_execution_data = true

examples/complete/outputs.tf

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ output "state_machine_status" {
1919
value = module.step_function.state_machine_status
2020
}
2121

22+
output "state_machine_version_arn" {
23+
description = "The ARN of state machine version"
24+
value = module.step_function.state_machine_version_arn
25+
}
26+
2227
# IAM Role
2328
output "role_arn" {
2429
description = "The ARN of the IAM role created for the State Machine"

examples/complete/versions.tf

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@ terraform {
22
required_version = ">= 1.0"
33

44
required_providers {
5-
aws = ">= 4.66"
6-
random = ">= 2"
7-
null = ">= 2"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 5.6"
8+
}
9+
random = {
10+
source = "hashicorp/random"
11+
version = ">= 2"
12+
}
13+
null = {
14+
source = "hashicorp/null"
15+
version = ">= 2"
16+
}
817
}
918
}

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ resource "aws_sfn_state_machine" "this" {
1919

2020
role_arn = var.use_existing_role ? var.role_arn : aws_iam_role.this[0].arn
2121
definition = var.definition
22+
publish = var.publish
2223

2324
dynamic "logging_configuration" {
2425
for_each = local.enable_logging ? [true] : []

outputs.tf

+5
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ output "state_machine_status" {
1919
value = try(aws_sfn_state_machine.this[0].status, "")
2020
}
2121

22+
output "state_machine_version_arn" {
23+
description = "The ARN of state machine version"
24+
value = try(aws_sfn_state_machine.this[0].state_machine_version_arn, "")
25+
}
26+
2227
# IAM Role
2328
output "role_arn" {
2429
description = "The ARN of the IAM role created for the Step Function"

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ variable "sfn_state_machine_timeouts" {
6767
default = {}
6868
}
6969

70+
variable "publish" {
71+
description = "Determines whether to set a version of the state machine when it is created."
72+
type = bool
73+
default = false
74+
}
75+
7076
#################
7177
# CloudWatch Logs
7278
#################

versions.tf

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ terraform {
22
required_version = ">= 1.0"
33

44
required_providers {
5-
aws = ">= 4.66"
5+
aws = {
6+
source = "hashicorp/aws"
7+
version = ">= 5.6"
8+
}
69
}
710
}

0 commit comments

Comments
 (0)