diff --git a/.changelog/24302.txt b/.changelog/24302.txt new file mode 100644 index 00000000000..083f2d3590c --- /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 diff --git a/internal/service/sfn/state_machine.go b/internal/service/sfn/state_machine.go index 1f9cfb00b6b..d8c7164e223 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())) }