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.81k stars 9.16k forks source link

[Bug]: when creating the aws_lexv2models_slot resource from list. #39901

Open bhochhi opened 4 hours ago

bhochhi commented 4 hours ago

Terraform Core Version

1.9.8

AWS Provider Version

5.73.0

Affected Resource(s)

aws_lexv2models_slot

module.lex.aws_lexv2models_slot.slots["ContactUs-Department"] will be created

Expected Behavior

create the slot resource

Actual Behavior

unable to create th slot resource for the intent

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files

module.lex.aws_lexv2models_slot.slots["ContactUs-Department"] will be created

Steps to Reproduce

  1. terraform {
     required_providers {
       aws = {
         source  = "hashicorp/aws"
         version = "~> 5.0"
       }
     }
     required_version = ">= 1.0.0"
    }
    
    provider "aws" {
     region = var.aws_region
    }
  2. main.tf

    variable "aws_region" {
     default = "us-west-2"
    }
    
    resource "aws_lexv2models_bot" "chatbot" {
     name        = "example_bot"
     description = "Example bot"
     role_arn    = "arn:aws:iam::123456789012:role/service-role/AmazonLexV2BotRole"
     data_privacy {
       child_directed = false
     }
     idle_session_ttl_in_seconds = 300
    }
    
    resource "aws_lexv2models_bot_locale" "bot_locale" {
     bot_id       = aws_lexv2models_bot.chatbot.id
     bot_version  = "DRAFT"
     locale_id    = "en_US"
     nlu_intent_confidence_threshold = 0.40
    }
    
    resource "aws_lexv2models_intent" "intents" {
     for_each = {
       "ContactUs" = {
         name        = "ContactUs"
         description = "Contact us intent"
       }
     }
    
     bot_id      = aws_lexv2models_bot.chatbot.id
     bot_version = "DRAFT"
     locale_id   = aws_lexv2models_bot_locale.bot_locale.locale_id
     name        = each.value.name
     description = each.value.description
    }
    
    resource "aws_lexv2models_slot" "slots" {
     for_each = {
       "ContactUs-Department" = {
         name         = "Department"
         description  = "Department slot"
         slot_type_id = "AMAZON.AlphaNumeric"
         intent_name  = "ContactUs"
         prompt       = "Which department would you like to contact?"
       }
     }
    
     name         = each.value.name
     description  = each.value.description
     slot_type_id = each.value.slot_type_id
     bot_id       = aws_lexv2models_bot.chatbot.id
     bot_version  = "DRAFT"
     locale_id    = aws_lexv2models_bot_locale.bot_locale.locale_id
     intent_id    = aws_lexv2models_intent.intents[each.value.intent_name].id
     value_elicitation_setting {
       slot_constraint = "Required"
       prompt_specification {
         allow_interrupt = true
         max_retries     = 3
         message_group {
           message {
             plain_text_message {
               value = each.value.prompt
             }
           }
         }
       }
     }
    }
  3. Now, init,play and apply, you will see Error

Debug Output

module.lex.aws_lexv2models_slot.slots["ContactUs-Department"]: Creating... ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.lex.aws_lexv2models_slot.slots["ContactUs-Department"], provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: │ .value_elicitation_setting[0].prompt_specification[0].prompt_attempts_specification: actual set element cty.ObjectVal(map[string]cty.Value{"allow_interrupt":cty.True, │ "allowed_input_types":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"allow_audio_input":cty.True, "allow_dtmf_input":cty.True})}), │ "audio_and_dtmf_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"audio_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"end_timeout_ms":cty.NumberIntVal(640), │ "max_length_ms":cty.NumberIntVal(15000)})}), "dtmf_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"deletion_character":cty.StringVal(""), "end_character":cty.StringVal("#"), │ "end_timeout_ms":cty.NumberIntVal(5000), "max_length":cty.NumberIntVal(513)})}), "start_timeout_ms":cty.NumberIntVal(4000)})}), "map_block_key":cty.StringVal("Initial"), │ "text_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"start_timeout_ms":cty.NumberIntVal(30000)})})}) does not correlate with any element in plan. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.lex.aws_lexv2models_slot.slots["ContactUs-Department"], provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: │ .value_elicitation_setting[0].prompt_specification[0].prompt_attempts_specification: actual set element cty.ObjectVal(map[string]cty.Value{"allow_interrupt":cty.True, │ "allowed_input_types":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"allow_audio_input":cty.True, "allow_dtmf_input":cty.True})}), │ "audio_and_dtmf_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"audio_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"end_timeout_ms":cty.NumberIntVal(640), │ "max_length_ms":cty.NumberIntVal(15000)})}), "dtmf_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"deletion_character":cty.StringVal(""), "end_character":cty.StringVal("#"), │ "end_timeout_ms":cty.NumberIntVal(5000), "max_length":cty.NumberIntVal(513)})}), "start_timeout_ms":cty.NumberIntVal(4000)})}), "map_block_key":cty.StringVal("Retry1"), │ "text_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"start_timeout_ms":cty.NumberIntVal(30000)})})}) does not correlate with any element in plan. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.lex.aws_lexv2models_slot.slots["ContactUs-Department"], provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: │ .value_elicitation_setting[0].prompt_specification[0].prompt_attempts_specification: actual set element cty.ObjectVal(map[string]cty.Value{"allow_interrupt":cty.True, │ "allowed_input_types":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"allow_audio_input":cty.True, "allow_dtmf_input":cty.True})}), │ "audio_and_dtmf_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"audio_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"end_timeout_ms":cty.NumberIntVal(640), │ "max_length_ms":cty.NumberIntVal(15000)})}), "dtmf_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"deletion_character":cty.StringVal(""), "end_character":cty.StringVal("#"), │ "end_timeout_ms":cty.NumberIntVal(5000), "max_length":cty.NumberIntVal(513)})}), "start_timeout_ms":cty.NumberIntVal(4000)})}), "map_block_key":cty.StringVal("Retry2"), │ "text_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"start_timeout_ms":cty.NumberIntVal(30000)})})}) does not correlate with any element in plan. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.lex.aws_lexv2models_slot.slots["ContactUs-Department"], provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: │ .value_elicitation_setting[0].prompt_specification[0].prompt_attempts_specification: actual set element cty.ObjectVal(map[string]cty.Value{"allow_interrupt":cty.True, │ "allowed_input_types":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"allow_audio_input":cty.True, "allow_dtmf_input":cty.True})}), │ "audio_and_dtmf_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"audio_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"end_timeout_ms":cty.NumberIntVal(640), │ "max_length_ms":cty.NumberIntVal(15000)})}), "dtmf_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"deletion_character":cty.StringVal(""), "end_character":cty.StringVal("#"), │ "end_timeout_ms":cty.NumberIntVal(5000), "max_length":cty.NumberIntVal(513)})}), "start_timeout_ms":cty.NumberIntVal(4000)})}), "map_block_key":cty.StringVal("Retry3"), │ "text_input_specification":cty.ListVal([]cty.Value{cty.ObjectVal(map[string]cty.Value{"start_timeout_ms":cty.NumberIntVal(30000)})})}) does not correlate with any element in plan. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵ ╷ │ Error: Provider produced inconsistent result after apply │ │ When applying changes to module.lex.aws_lexv2models_slot.slots["ContactUs-Department"], provider "provider[\"registry.terraform.io/hashicorp/aws\"]" produced an unexpected new value: │ .value_elicitation_setting[0].prompt_specification[0].prompt_attempts_specification: block set length changed from 0 to 4. │ │ This is a bug in the provider, which should be reported in the provider's own issue tracker. ╵

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue