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

resource/aws_appsync_resolver: Add CachingConfig support #12747

Merged
merged 9 commits into from
May 11, 2020

Conversation

ackintosh
Copy link
Contributor

@ackintosh ackintosh commented Apr 9, 2020

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Release note for CHANGELOG:

ENHANCEMENTS:

* resource/aws_appsync_resolver: Add `caching_config` block

Output from acceptance testing:

AWS_PROFILE=default make testacc TEST=./aws TESTARGS='-run=TestAccAwsAppsyncResolver_CachingConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsAppsyncResolver_CachingConfig -timeout 120m
=== RUN   TestAccAwsAppsyncResolver_CachingConfig
=== PAUSE TestAccAwsAppsyncResolver_CachingConfig
=== CONT  TestAccAwsAppsyncResolver_CachingConfig
--- PASS: TestAccAwsAppsyncResolver_CachingConfig (89.42s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       89.490s

@ghost ghost added size/S Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. service/appsync Issues and PRs that pertain to the appsync service. documentation Introduces or discusses updates to documentation. size/M Managed by automation to categorize the size of a PR. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. and removed size/S Managed by automation to categorize the size of a PR. size/M Managed by automation to categorize the size of a PR. labels Apr 9, 2020
@ackintosh ackintosh marked this pull request as ready for review April 9, 2020 15:05
@ackintosh ackintosh requested a review from a team April 9, 2020 15:05
@ackintosh
Copy link
Contributor Author

The CI job has completed successfully but the status on github is still Pending... 🤔

https://travis-ci.org/github/terraform-providers/terraform-provider-aws/builds/673029687

@ackintosh ackintosh force-pushed the appsync-caching-config branch 2 times, most recently from 365367d to 5e25214 Compare April 15, 2020 02:54
@ackintosh
Copy link
Contributor Author

Whew, this PR is ready for review!

@ackintosh
Copy link
Contributor Author

This PR closes #13230

"caching_config": {
Type: schema.TypeList,
Optional: true,
Elem: &schema.Resource{
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add MaxItems: 1, .

Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"caching_keys": {
Type: schema.TypeList,
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest

Type:     schema.TypeSet,
Set:      schema.HashString,

here as order is not important.

m := l[0].(map[string]interface{})

cachingConfig := &appsync.CachingConfig{
CachingKeys: expandStringList(m["caching_keys"].([]interface{})),
Copy link
Contributor

Choose a reason for hiding this comment

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

CachingKeys: expandStringSet(m["caching_keys"].(*schema.Set)),

aws/structure.go Outdated
}

m := map[string]interface{}{
"caching_keys": flattenStringList(c.CachingKeys),
Copy link
Contributor

Choose a reason for hiding this comment

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

flattenStringSet(c.CachingKeys)

aws/structure.go Outdated
@@ -5565,6 +5565,23 @@ func flattenAppsyncPipelineConfig(c *appsync.PipelineConfig) []interface{} {
return []interface{}{m}
}

func flattenAppsyncCachingConfig(c *appsync.CachingConfig) []interface{} {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move to aws/resource_aws_appsync_resolver.go to avoid overloading this file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, thank you!

I'll also move flattenAppsyncPipelineConfig together with flattenAppsyncCachingConfig to aws/resource_aws_appsync_resolver.go. 💡

Btw, besides flattenAppsync**, I can see some resource-specific function as well in structure.go but I'm not sure why the functions are in the structure.go. 🤔

@ackintosh
Copy link
Contributor Author

After the updates, I've checked the acceptance tests have passed. 😌

Output:

$ AWS_PROFILE=default make testacc TEST=./aws TESTARGS='-run=TestAccAwsAppsyncResolver_CachingConfig'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -count 1 -parallel 20 -run=TestAccAwsAppsyncResolver_CachingConfig -timeout 120m
go: downloading github.com/aws/aws-sdk-go v1.30.21
=== RUN   TestAccAwsAppsyncResolver_CachingConfig
=== PAUSE TestAccAwsAppsyncResolver_CachingConfig
=== CONT  TestAccAwsAppsyncResolver_CachingConfig
--- PASS: TestAccAwsAppsyncResolver_CachingConfig (74.90s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       74.945s

@ackintosh
Copy link
Contributor Author

@ewbankkit Thank you for your review! Please have another look when you have time. 😃

@ewbankkit
Copy link
Contributor

Verified acceptance tests:

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAwsAppsyncResolver_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -count 1 -parallel 20 -run=TestAccAwsAppsyncResolver_ -timeout 120m
=== RUN   TestAccAwsAppsyncResolver_basic
=== PAUSE TestAccAwsAppsyncResolver_basic
=== RUN   TestAccAwsAppsyncResolver_disappears
=== PAUSE TestAccAwsAppsyncResolver_disappears
=== RUN   TestAccAwsAppsyncResolver_DataSource
=== PAUSE TestAccAwsAppsyncResolver_DataSource
=== RUN   TestAccAwsAppsyncResolver_RequestTemplate
=== PAUSE TestAccAwsAppsyncResolver_RequestTemplate
=== RUN   TestAccAwsAppsyncResolver_ResponseTemplate
=== PAUSE TestAccAwsAppsyncResolver_ResponseTemplate
=== RUN   TestAccAwsAppsyncResolver_multipleResolvers
=== PAUSE TestAccAwsAppsyncResolver_multipleResolvers
=== RUN   TestAccAwsAppsyncResolver_PipelineConfig
=== PAUSE TestAccAwsAppsyncResolver_PipelineConfig
=== RUN   TestAccAwsAppsyncResolver_CachingConfig
=== PAUSE TestAccAwsAppsyncResolver_CachingConfig
=== CONT  TestAccAwsAppsyncResolver_basic
=== CONT  TestAccAwsAppsyncResolver_multipleResolvers
=== CONT  TestAccAwsAppsyncResolver_CachingConfig
=== CONT  TestAccAwsAppsyncResolver_PipelineConfig
=== CONT  TestAccAwsAppsyncResolver_RequestTemplate
=== CONT  TestAccAwsAppsyncResolver_ResponseTemplate
=== CONT  TestAccAwsAppsyncResolver_DataSource
=== CONT  TestAccAwsAppsyncResolver_disappears
--- PASS: TestAccAwsAppsyncResolver_PipelineConfig (29.86s)
--- PASS: TestAccAwsAppsyncResolver_disappears (30.41s)
--- PASS: TestAccAwsAppsyncResolver_CachingConfig (37.19s)
--- PASS: TestAccAwsAppsyncResolver_multipleResolvers (41.31s)
--- PASS: TestAccAwsAppsyncResolver_ResponseTemplate (46.97s)
--- PASS: TestAccAwsAppsyncResolver_DataSource (50.75s)
--- PASS: TestAccAwsAppsyncResolver_RequestTemplate (50.87s)
--- PASS: TestAccAwsAppsyncResolver_basic (75.71s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	75.754s

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels May 11, 2020
Copy link
Member

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Thanks @ackintosh 🚀

Output from acceptance testing:

--- PASS: TestAccAwsAppsyncResolver_disappears (17.59s)
--- PASS: TestAccAwsAppsyncResolver_CachingConfig (21.28s)
--- PASS: TestAccAwsAppsyncResolver_PipelineConfig (21.32s)
--- PASS: TestAccAwsAppsyncResolver_ResponseTemplate (27.75s)
--- PASS: TestAccAwsAppsyncResolver_basic (30.41s)
--- PASS: TestAccAwsAppsyncResolver_RequestTemplate (32.44s)
--- PASS: TestAccAwsAppsyncResolver_multipleResolvers (33.10s)
--- PASS: TestAccAwsAppsyncResolver_DataSource (35.67s)

@bflad bflad added this to the v2.62.0 milestone May 11, 2020
@bflad bflad linked an issue May 11, 2020 that may be closed by this pull request
@bflad bflad merged commit ebc3406 into hashicorp:master May 11, 2020
bflad added a commit that referenced this pull request May 11, 2020
@ackintosh ackintosh deleted the appsync-caching-config branch May 11, 2020 23:52
@ghost
Copy link

ghost commented May 15, 2020

This has been released in version 2.62.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!

adamdecaf pushed a commit to adamdecaf/terraform-provider-aws that referenced this pull request May 28, 2020
…2747)

Output from acceptance testing:

```
--- PASS: TestAccAwsAppsyncResolver_disappears (17.59s)
--- PASS: TestAccAwsAppsyncResolver_CachingConfig (21.28s)
--- PASS: TestAccAwsAppsyncResolver_PipelineConfig (21.32s)
--- PASS: TestAccAwsAppsyncResolver_ResponseTemplate (27.75s)
--- PASS: TestAccAwsAppsyncResolver_basic (30.41s)
--- PASS: TestAccAwsAppsyncResolver_RequestTemplate (32.44s)
--- PASS: TestAccAwsAppsyncResolver_multipleResolvers (33.10s)
--- PASS: TestAccAwsAppsyncResolver_DataSource (35.67s)
```
@ghost
Copy link

ghost commented Jun 11, 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 and limited conversation to collaborators Jun 11, 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. enhancement Requests to existing resources that expand the functionality or scope. service/appsync Issues and PRs that pertain to the appsync service. size/L 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.

resource/aws_appsync_resolver: Add CachingConfig support
3 participants