Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lex intent data source and resource #8917

Merged
merged 20 commits into from
Sep 29, 2020
Merged

Add Lex intent data source and resource #8917

merged 20 commits into from
Sep 29, 2020

Conversation

jzbruno
Copy link
Contributor

@jzbruno jzbruno commented Jun 10, 2019

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Relates #905 and split from PR #2616

Release note for CHANGELOG:

FEATURES:
* **New Data Source:** `aws_lex_intent`
* **New Resource:** `aws_lex_intent`

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccDataSourceAwsLexIntent'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccDataSourceAwsLexIntent -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccDataSourceAwsLexIntent
--- PASS: TestAccDataSourceAwsLexIntent (12.67s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	12.708s

$ make testacc TESTARGS='-run=TestAccAwsLexIntent'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsLexIntent -timeout 120m
?   	github.com/terraform-providers/terraform-provider-aws	[no test files]
=== RUN   TestAccAwsLexIntent
=== PAUSE TestAccAwsLexIntent
=== CONT  TestAccAwsLexIntent
--- PASS: TestAccAwsLexIntent (30.90s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	30.977s

@ghost ghost added size/XXL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. service/lexmodels Issues and PRs that pertain to the lexmodels service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jun 10, 2019
@nywilken nywilken added this to the v2.16.0 milestone Jun 10, 2019
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jzbruno I'm working through this PR and have a number of questions around expectations for the Lex intent resource. The combination of the data source along with the resources is proving a bit difficult to review all of the changes. Please take a minute to address the comments so far so than I can continue reviewing.

aws/data_source_aws_lex_intent_test.go Outdated Show resolved Hide resolved
aws/data_source_aws_lex_intent.go Outdated Show resolved Hide resolved
website/docs/d/lex_intent.html.markdown Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/data_source_aws_lex_intent.go Show resolved Hide resolved
@nywilken nywilken modified the milestones: v2.16.0, v2.17.0 Jun 20, 2019
@nywilken nywilken added the waiting-response Maintainers are waiting on response from community or contributor. label Jun 20, 2019
@nywilken nywilken modified the milestones: v2.17.0, v2.18.0 Jun 21, 2019
@jzbruno jzbruno requested a review from a team June 24, 2019 05:34
@bflad bflad modified the milestones: v2.18.0, v2.19.0, v2.20.0 Jul 5, 2019
@nywilken nywilken modified the milestones: v2.20.0, v2.21.0 Jul 19, 2019
@bflad bflad modified the milestones: v2.21.0, v2.22.0 Jul 25, 2019
@jzbruno
Copy link
Contributor Author

jzbruno commented Jul 30, 2019

@nywilken I will look at this tonight.

@gdavison gdavison added the waiting-response Maintainers are waiting on response from community or contributor. label Sep 15, 2020
@hashicorp hashicorp deleted a comment from nywilken Sep 17, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is off to a good start, @jzbruno. I've added a number of suggestions

aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent_test.go Show resolved Hide resolved
aws/data_source_aws_lex_intent_test.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent.go Outdated Show resolved Hide resolved
Comment on lines 197 to 208
// requires a lambda function to test
// dialog_code_hook {
// message_version = "1"
// uri = "arn:aws:lambda:us-east-1:123456789012:function:RetrieveAvailableFlowers"
// }

fulfillment_activity {
// requires a lambda function to test
// code_hook {
// message_version = "1"
// uri = "arn:aws:lambda:us-east-1:123456789012:function:ProcessFlowerOrder"
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For fields that require a Lambda function, we could just create a dummy Lambda function so that we have an ARN to use

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being problematic. I'll explain when I push the other changes this morning.

website/docs/d/lex_intent.html.markdown Outdated Show resolved Hide resolved
aws/resource_aws_lex_intent_test.go Show resolved Hide resolved
aws/data_source_aws_lex_intent.go Outdated Show resolved Hide resolved
aws/data_source_aws_lex_intent.go Show resolved Hide resolved
@nbmustafa
Copy link

nbmustafa commented Sep 20, 2020

there is quite some people out there are eagerly watching and waiting for some good news soon. there has been an excellent effort by @jzbruno and @gdavison. I keep watching this out every single hour.

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Sep 20, 2020
@gdavison
Copy link
Contributor

Hi @jzbruno. Thanks again for all the work you've put in on the Lex service. Are you still interested in working on this, or are you short on time to work on it? If you'd like, I can pick up the PRs and get them merged in.

@jzbruno
Copy link
Contributor Author

jzbruno commented Sep 25, 2020

@gdavison I'm working on this today. I may ask for help finishing this and the other 2 PRs. Let's see how far I get.

@jzbruno
Copy link
Contributor Author

jzbruno commented Sep 27, 2020

@gdavison

Phew, ok! Thanks for the reviews! I have pushed the latest changes, quite a lot of changes :) (mostly for test cases). Here are some notes. Think we are close.

  • Adding tagging, I would say create a new issue.
  • Adding remaining attributes to data source, I would say create a new issue.
  • Adding the "dummy" Lambda function to tests I have seen some sporadic failures due to IAM policy involving Lex not being ready I believe ... This can affect the test for dialag_code_hook and fulfillment_activity with a code hook. Latest run results are below and successful.
~/src/github/terraform-providers/terraform-provider-aws [error 2] $ make testacc TESTARGS='-run=TestAcc.*LexIntent.*'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAcc.*LexIntent.* -timeout 120m
=== RUN   TestAccDataSourceAwsLexIntent_basic
=== PAUSE TestAccDataSourceAwsLexIntent_basic
=== RUN   TestAccDataSourceAwsLexIntent_withVersion
=== PAUSE TestAccDataSourceAwsLexIntent_withVersion
=== RUN   TestAccAwsLexIntent_basic
=== PAUSE TestAccAwsLexIntent_basic
=== RUN   TestAccAwsLexIntent_createVersion
=== PAUSE TestAccAwsLexIntent_createVersion
=== RUN   TestAccAwsLexIntent_conclusionStatement
=== PAUSE TestAccAwsLexIntent_conclusionStatement
=== RUN   TestAccAwsLexIntent_confirmationPromptAndRejectionStatement
=== PAUSE TestAccAwsLexIntent_confirmationPromptAndRejectionStatement
=== RUN   TestAccAwsLexIntent_dialogCodeHook
=== PAUSE TestAccAwsLexIntent_dialogCodeHook
=== RUN   TestAccAwsLexIntent_followUpPrompt
=== PAUSE TestAccAwsLexIntent_followUpPrompt
=== RUN   TestAccAwsLexIntent_fulfillmentActivity
=== PAUSE TestAccAwsLexIntent_fulfillmentActivity
=== RUN   TestAccAwsLexIntent_sampleUtterances
=== PAUSE TestAccAwsLexIntent_sampleUtterances
=== RUN   TestAccAwsLexIntent_slots
=== PAUSE TestAccAwsLexIntent_slots
=== RUN   TestAccAwsLexIntent_slotsCustom
=== PAUSE TestAccAwsLexIntent_slotsCustom
=== RUN   TestAccAwsLexIntent_disappears
=== PAUSE TestAccAwsLexIntent_disappears
=== RUN   TestAccAwsLexIntent_updateWithExternalChange
=== PAUSE TestAccAwsLexIntent_updateWithExternalChange
=== CONT  TestAccDataSourceAwsLexIntent_basic
=== CONT  TestAccAwsLexIntent_fulfillmentActivity
=== CONT  TestAccAwsLexIntent_updateWithExternalChange
=== CONT  TestAccAwsLexIntent_slotsCustom
=== CONT  TestAccDataSourceAwsLexIntent_withVersion
=== CONT  TestAccAwsLexIntent_slots
=== CONT  TestAccAwsLexIntent_sampleUtterances
=== CONT  TestAccAwsLexIntent_disappears
=== CONT  TestAccAwsLexIntent_conclusionStatement
=== CONT  TestAccAwsLexIntent_followUpPrompt
=== CONT  TestAccAwsLexIntent_dialogCodeHook
=== CONT  TestAccAwsLexIntent_confirmationPromptAndRejectionStatement
=== CONT  TestAccAwsLexIntent_basic
=== CONT  TestAccAwsLexIntent_createVersion
=== CONT  TestAccAwsLexIntent_updateWithExternalChange
    resource_aws_lex_intent_test.go:551: [INFO] Got non-empty plan, as expected
=== CONT  TestAccAwsLexIntent_disappears
    resource_aws_lex_intent_test.go:492: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAwsLexIntent_disappears (22.48s)
2020/09/26 17:33:48 [INFO] AWS Auth provider used: "EnvProvider"
--- PASS: TestAccDataSourceAwsLexIntent_basic (27.35s)
--- PASS: TestAccDataSourceAwsLexIntent_withVersion (28.32s)
--- PASS: TestAccAwsLexIntent_basic (32.44s)
--- PASS: TestAccAwsLexIntent_slotsCustom (39.99s)
--- PASS: TestAccAwsLexIntent_updateWithExternalChange (43.72s)
--- PASS: TestAccAwsLexIntent_sampleUtterances (50.11s)
--- PASS: TestAccAwsLexIntent_dialogCodeHook (50.79s)
--- PASS: TestAccAwsLexIntent_followUpPrompt (51.65s)
--- PASS: TestAccAwsLexIntent_slots (52.38s)
--- PASS: TestAccAwsLexIntent_confirmationPromptAndRejectionStatement (53.09s)
--- PASS: TestAccAwsLexIntent_conclusionStatement (53.75s)
--- PASS: TestAccAwsLexIntent_createVersion (54.78s)
--- PASS: TestAccAwsLexIntent_fulfillmentActivity (58.14s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	59.638s
~/src/github/terraform-providers/terraform-provider-aws [error 1] $ make testacc TESTARGS='-run=TestAcc.*LexSlotType.*'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAcc.*LexSlotType.* -timeout 120m
=== RUN   TestAccDataSourceAwsLexSlotType_basic
=== PAUSE TestAccDataSourceAwsLexSlotType_basic
=== RUN   TestAccDataSourceAwsLexSlotType_withVersion
=== PAUSE TestAccDataSourceAwsLexSlotType_withVersion
=== RUN   TestAccAwsLexSlotType_basic
=== PAUSE TestAccAwsLexSlotType_basic
=== RUN   TestAccAwsLexSlotType_createVersion
=== PAUSE TestAccAwsLexSlotType_createVersion
=== RUN   TestAccAwsLexSlotType_description
=== PAUSE TestAccAwsLexSlotType_description
=== RUN   TestAccAwsLexSlotType_enumerationValues
=== PAUSE TestAccAwsLexSlotType_enumerationValues
=== RUN   TestAccAwsLexSlotType_name
=== PAUSE TestAccAwsLexSlotType_name
=== RUN   TestAccAwsLexSlotType_valueSelectionStrategy
=== PAUSE TestAccAwsLexSlotType_valueSelectionStrategy
=== RUN   TestAccAwsLexSlotType_disappears
=== PAUSE TestAccAwsLexSlotType_disappears
=== CONT  TestAccDataSourceAwsLexSlotType_basic
=== CONT  TestAccAwsLexSlotType_enumerationValues
=== CONT  TestAccAwsLexSlotType_createVersion
=== CONT  TestAccAwsLexSlotType_disappears
=== CONT  TestAccAwsLexSlotType_valueSelectionStrategy
=== CONT  TestAccAwsLexSlotType_name
=== CONT  TestAccAwsLexSlotType_basic
=== CONT  TestAccDataSourceAwsLexSlotType_withVersion
=== CONT  TestAccAwsLexSlotType_description
2020/09/26 17:38:17 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
2020/09/26 17:38:17 [WARN] Truncating attribute path of 0 diagnostics for TypeSet
=== CONT  TestAccAwsLexSlotType_disappears
    resource_aws_lex_slot_type_test.go:270: [INFO] Got non-empty plan, as expected
--- PASS: TestAccAwsLexSlotType_disappears (18.67s)
--- PASS: TestAccDataSourceAwsLexSlotType_withVersion (23.00s)
--- PASS: TestAccDataSourceAwsLexSlotType_basic (23.95s)
--- PASS: TestAccAwsLexSlotType_basic (27.34s)
--- PASS: TestAccAwsLexSlotType_valueSelectionStrategy (52.13s)
--- PASS: TestAccAwsLexSlotType_enumerationValues (53.33s)
--- PASS: TestAccAwsLexSlotType_name (54.61s)
--- PASS: TestAccAwsLexSlotType_description (57.22s)
--- PASS: TestAccAwsLexSlotType_createVersion (61.82s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	63.342s

Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

--- PASS: TestAccAwsLexIntent_disappears (51.98s)
--- PASS: TestAccDataSourceAwsLexIntent_withVersion (62.35s)
--- PASS: TestAccDataSourceAwsLexSlotType_withVersion (63.24s)
--- PASS: TestAccDataSourceAwsLexSlotType_basic (64.29s)
--- PASS: TestAccDataSourceAwsLexIntent_basic (65.33s)
--- PASS: TestAccAwsLexIntent_basic (71.85s)
--- PASS: TestAccAwsLexSlotType_basic (72.88s)
--- PASS: TestAccAwsLexIntent_slotsCustom (89.72s)
--- PASS: TestAccAwsLexIntent_dialogCodeHook (96.35s)
--- PASS: TestAccAwsLexIntent_fulfillmentActivity (96.44s)
--- PASS: TestAccAwsLexIntent_updateWithExternalChange (100.47s)
--- PASS: TestAccAwsLexSlotType_disappears (39.93s)
--- PASS: TestAccAwsLexIntent_confirmationPromptAndRejectionStatement (110.13s)
--- PASS: TestAccAwsLexSlotType_enumerationValues (110.94s)
--- PASS: TestAccAwsLexSlotType_createVersion (112.55s)
--- PASS: TestAccAwsLexIntent_sampleUtterances (113.02s)
--- PASS: TestAccAwsLexSlotType_description (113.73s)
--- PASS: TestAccAwsLexIntent_followUpPrompt (114.68s)
--- PASS: TestAccAwsLexIntent_createVersion (116.21s)
--- PASS: TestAccAwsLexIntent_slots (120.38s)
--- PASS: TestAccAwsLexSlotType_valueSelectionStrategy (61.61s)
--- PASS: TestAccAwsLexSlotType_name (85.81s)
--- PASS: TestAccAwsLexIntent_conclusionStatement (139.21s)

Comment on lines 25 to -34
resource.TestCheckResourceAttrPair(dataSourceName, "checksum", resourceName, "checksum"),
resource.TestCheckResourceAttrPair(dataSourceName, "created_date", resourceName, "created_date"),
resource.TestCheckResourceAttrPair(dataSourceName, "description", resourceName, "description"),
resource.TestCheckResourceAttrPair(dataSourceName, "enumeration_value.#", resourceName, "enumeration_value.#"),
resource.TestCheckResourceAttrPair(dataSourceName, "last_updated_date", resourceName, "last_updated_date"),
resource.TestCheckResourceAttrPair(dataSourceName, "name", resourceName, "name"),
resource.TestCheckResourceAttrPair(dataSourceName, "value_selection_strategy", resourceName, "value_selection_strategy"),
resource.TestCheckResourceAttrPair(dataSourceName, "version", resourceName, "version"),
resource.TestCheckResourceAttrPair(dataSourceName, "created_date", resourceName, "created_date"),
testAccCheckResourceAttrRfc3339(dataSourceName, "created_date"),
resource.TestCheckResourceAttrPair(dataSourceName, "last_updated_date", resourceName, "last_updated_date"),
testAccCheckResourceAttrRfc3339(dataSourceName, "last_updated_date"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you kept this in alphabetical order :)

aws/resource_aws_lex_intent.go Show resolved Hide resolved
aws/data_source_aws_lex_intent.go Show resolved Hide resolved
@gdavison gdavison modified the milestones: Roadmap, v3.9.0 Sep 29, 2020
@gdavison gdavison merged commit a12d7d1 into hashicorp:master Sep 29, 2020
gdavison added a commit that referenced this pull request Sep 29, 2020
@ghost
Copy link

ghost commented Oct 2, 2020

This has been released in version 3.9.0 of the Terraform AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Oct 30, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Oct 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. new-data-source Introduces a new data source. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. service/lexmodels Issues and PRs that pertain to the lexmodels service. size/XXL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants