hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.84k stars 9.19k forks source link

[Bug]: lexv2models/intent: `confirmation_setting` produces diffs for `prompt_attempts_specification` #35346

Open YakDriver opened 10 months ago

YakDriver commented 10 months ago

Terraform Core Version

1.6.6

AWS Provider Version

5.32.1

Affected Resource(s)

Expected Behavior

No differences reported.

Actual Behavior

This is noted in the documentation.

Differences reported when you use confirmation_setting without configuring confirmation_setting.prompt_specification.prompt_attempts_specifications for Initial and Retry1.

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

Reports diffs:

resource "aws_lexv2models_intent" "example" {
  bot_id      = aws_lexv2models_bot.test.id
  bot_version = aws_lexv2models_bot_locale.test.bot_version
  name        = "botens_namn"
  locale_id   = aws_lexv2models_bot_locale.test.locale_id

  confirmation_setting {
    active = true

    prompt_specification {
      allow_interrupt            = true
      max_retries                = 1
      message_selection_strategy = "Ordered"
    }
  }
}

Doesn't report diffs:

resource "aws_lexv2models_intent" "example" {
  bot_id      = aws_lexv2models_bot.test.id
  bot_version = aws_lexv2models_bot_locale.test.bot_version
  name        = "botens_namn"
  locale_id   = aws_lexv2models_bot_locale.test.locale_id

  confirmation_setting {
    active = true

    prompt_specification {
      allow_interrupt            = true
      max_retries                = 1
      message_selection_strategy = "Ordered"

      prompt_attempts_specification {
        allow_interrupt = true
        map_block_key   = "Initial"

        allowed_input_types {
          allow_audio_input = true
          allow_dtmf_input  = true
        }

        audio_and_dtmf_input_specification {
          start_timeout_ms = 4000

          audio_specification {
            end_timeout_ms = 640
            max_length_ms  = 15000
          }

          dtmf_specification {
            deletion_character = "*"
            end_character      = "#"
            end_timeout_ms     = 5000
            max_length         = 513
          }
        }

        text_input_specification {
          start_timeout_ms = 30000
        }
      }

      prompt_attempts_specification {
        allow_interrupt = true
        map_block_key   = "Retry1"

        allowed_input_types {
          allow_audio_input = true
          allow_dtmf_input  = true
        }

        audio_and_dtmf_input_specification {
          start_timeout_ms = 4000

          audio_specification {
            end_timeout_ms = 640
            max_length_ms  = 15000
          }

          dtmf_specification {
            deletion_character = "*"
            end_character      = "#"
            end_timeout_ms     = 5000
            max_length         = 513
          }
        }

        text_input_specification {
          start_timeout_ms = 30000
        }
      }
    }
  }
}

Steps to Reproduce

  1. terraform apply

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

Would you like to implement a fix?

None

github-actions[bot] commented 10 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

nam054 commented 3 months ago

Relates to #36845

nam054 commented 1 week ago

This issue is a result of AWS returning more configurations than what was sent, which the provider cannot suppress the differences for at this time. Often these differences would be suppressed using custom diff suppress logic, but this behavior manifests in such a way that the upstream SDK (terraform-plugin-framework) does not allow this. Currently, the workaround is leaning on documentation (more detail here) that will exemplify exactly what is needed when dealing with the max_retries attribute. This is an open issue that details the same problem in framework: https://github.com/hashicorp/terraform-plugin-framework/issues/883.