terraform-provider-awscc icon indicating copy to clipboard operation
terraform-provider-awscc copied to clipboard

Refreshing state takes minutes for a handful of resources, CPU utilisation 150%

Open gevial opened this issue 2 years ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • The resources and data sources in this provider are generated from the CloudFormation schema, so they can only support the actions that the underlying schema supports. For this reason submitted bugs should be limited to defects in the generation and runtime code of the provider. Customizing behavior of the resource, or noting a gap in behavior are not valid bugs and should be submitted as enhancements to AWS via the CloudFormation Open Coverage Roadmap.

Terraform CLI and Terraform AWS Cloud Control Provider Version

Terraform v1.2.6 on darwin_amd64

Affected Resource(s)

  • awscc_lex_bot.util

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

terraform {
  required_providers {
    aws = {
      version = ">= 4.0"
      source  = "hashicorp/aws"
    }
    awscc = {
      version = ">= 0.29"
      source  = "hashicorp/awscc"
    }
  }
}

provider "aws" {
  region = "eu-west-2"
}

provider "awscc" {
  region = "eu-west-2"
}

resource "awscc_connect_phone_number" "this" {
  country_code = "GB"
  target_arn   = aws_connect_instance.this.arn
  type         = "DID"
}

resource "awscc_lex_bot" "util" {
  name = "Util"
  data_privacy = {
    child_directed = false
  }
  idle_session_ttl_in_seconds = 300
  role_arn                    = aws_iam_role.bots.arn
  auto_build_bot_locales      = true
  bot_locales = [
    {
      locale_id                = "en_GB"
      nlu_confidence_threshold = 0.5
      intents = [
        {
          name = "Greeting"
          sample_utterances = [
            { utterance = "Hi" },
            { utterance = "Hello" },
            { utterance = "Hiya" },
            { utterance = "Hi there" },
            { utterance = "Good morning" },
            { utterance = "Good afternoon" },
            { utterance = "Greetings" },
          ]
        },
        {
          name = "Yes"
          sample_utterances = [
            { utterance = "Yes" },
            { utterance = "Yep" },
            { utterance = "Yeah" },
            { utterance = "Definitely" },
            { utterance = "I think so" },
            { utterance = "Absolutely" },
          ]
        },
        {
          name = "No"
          sample_utterances = [
            { utterance = "No" },
            { utterance = "Nope" },
            { utterance = "That's it" },
            { utterance = "No, thank you" },
            { utterance = "No, thanks" },
          ]
        },
        {
          name                    = "FallbackIntent"
          parent_intent_signature = "AMAZON.FallbackIntent"
        }
      ]
    }
  ]
}

Debug Output

Panic Output

Expected Behavior

State refreshed in reasonable time (I believe in under 1m for a couple of resources), no excessive CPU usage

Actual Behavior

State of awscc_lex_bot is being refreshed in several minutes with CPU utilisation of awscc-terraform-provider process of 150% Screenshot 2022-08-10 at 11 19 45

Steps to Reproduce

  1. terraform plan

Important Factoids

References

  • #0000

gevial avatar Aug 10 '22 10:08 gevial

I can now see the same behaviour when refreshing state of awscc_connect_phone_number

gevial avatar Aug 10 '22 10:08 gevial

Also noticed that after Terraform showed this: Plan: 1 to add, 0 to change, 0 to destroy. it didn't release the console input back and CPU utilisation was still 150%. I think it would time out, but I just entered Yes without a prompt and it proceeds with creating.

gevial avatar Aug 10 '22 10:08 gevial