From 292645a047b8db4290981c80af31145cc6894d5f Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Mon, 18 Apr 2022 17:13:41 -0400 Subject: [PATCH 1/2] r/sfn_state_machine: prevent panic when accessing the tracing or logging config of the state machine after update --- internal/service/sfn/state_machine.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/service/sfn/state_machine.go b/internal/service/sfn/state_machine.go index 1f9cfb00b6bf..d8c7164e2233 100644 --- a/internal/service/sfn/state_machine.go +++ b/internal/service/sfn/state_machine.go @@ -290,9 +290,9 @@ func resourceStateMachineUpdate(d *schema.ResourceData, meta interface{}) error if d.HasChange("definition") && !verify.JSONBytesEqual([]byte(aws.StringValue(output.Definition)), []byte(d.Get("definition").(string))) || d.HasChange("role_arn") && aws.StringValue(output.RoleArn) != d.Get("role_arn").(string) || - d.HasChange("tracing_configuration.0.enabled") && aws.BoolValue(output.TracingConfiguration.Enabled) != d.Get("tracing_configuration.0.enabled").(bool) || - d.HasChange("logging_configuration.0.include_execution_data") && aws.BoolValue(output.LoggingConfiguration.IncludeExecutionData) != d.Get("logging_configuration.0.include_execution_data").(bool) || - d.HasChange("logging_configuration.0.level") && aws.StringValue(output.LoggingConfiguration.Level) != d.Get("logging_configuration.0.level").(string) { + d.HasChange("tracing_configuration.0.enabled") && output.TracingConfiguration != nil && aws.BoolValue(output.TracingConfiguration.Enabled) != d.Get("tracing_configuration.0.enabled").(bool) || + d.HasChange("logging_configuration.0.include_execution_data") && output.LoggingConfiguration != nil && aws.BoolValue(output.LoggingConfiguration.IncludeExecutionData) != d.Get("logging_configuration.0.include_execution_data").(bool) || + d.HasChange("logging_configuration.0.level") && output.LoggingConfiguration != nil && aws.StringValue(output.LoggingConfiguration.Level) != d.Get("logging_configuration.0.level").(string) { return resource.RetryableError(fmt.Errorf("Step Function State Machine (%s) eventual consistency", d.Id())) } From 6246d1a26c3c624be88dc530deda938024e785a1 Mon Sep 17 00:00:00 2001 From: Angie Pinilla Date: Mon, 18 Apr 2022 17:18:05 -0400 Subject: [PATCH 2/2] Update CHANGELOG for #24302 --- .changelog/24302.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/24302.txt diff --git a/.changelog/24302.txt b/.changelog/24302.txt new file mode 100644 index 000000000000..083f2d3590ca --- /dev/null +++ b/.changelog/24302.txt @@ -0,0 +1,3 @@ +```release-note:bug +resource/aws_sfn_state_machine: Prevent panic during resource update +``` \ No newline at end of file