hashicorp / terraform-provider-awscc

Terraform AWS Cloud Control provider
https://registry.terraform.io/providers/hashicorp/awscc/latest/docs
Mozilla Public License 2.0
249 stars 114 forks source link

awscc_lex_bot_alias lifecycle {ignore_changes} does not ignore changes #1962

Open rug-grygiel opened 1 month ago

rug-grygiel commented 1 month ago

Community Note

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.7.5 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

resource "awscc_lex_bot_alias" "calculate" {
  bot_alias_name = "calculate"
  bot_id  = aws_cloudformation_stack.calculator.outputs.BotId
  bot_version = aws_lexv2models_bot_version.calculator-bot-version.bot_version
  description    = "Calculate"
  bot_alias_locale_settings = local.calculator-aliases-locale-specification

  bot_alias_tags = [{
    key   = "environment"
    value = "poc"
  }]

  conversation_log_settings = {
    audio_log_settings = [{
      enabled = true
      destination = {
        s3_bucket = {
          log_prefix    = "poc"
          s3_bucket_arn = aws_s3_bucket.conversation_logs.arn
        }
      }
    }]
    text_log_settings = [{
      enabled = false
      destination = {
        cloudwatch = {
          log_prefix               = "poc"
          cloudwatch_log_group_arn = aws_cloudwatch_log_group.attribute-log-group.arn
        }
      }
    }]
  lifecycle {
    ignore_changes = [
      conversation_log_settings
    ]
  }
  }

Expected Behavior

Expected lifecycle to ignore changes but it did not.

Actual Behavior

Acted as if ignore_changes was not present.

Steps to Reproduce

  1. terraform apply
  2. terraform plan

Important Factoids

I tried Ignoring conversation_log_settings and sub-levels with no success.

References

quixoticmonk commented 1 week ago

As with #1961 , the issue seems to be on sentiment_analysis_settings which is set to a default false value from the API when it is not set on the config. If you set the lifecycle rule below, you wouldn't see the issue with the subsequent applies. I would keep #1961 open as we would like to investigate that further.

    lifecycle {
    ignore_changes = [
      sentiment_analysis_settings
    ]
  }