-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
r/aws_appsync_resolver: Support direct resolver #14710
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was just about to open a PR with these changes before searching and finding yours... This is exactly how I implemented it though, looks great! (only difference was that I put the two template GetOk checks above pipeline_config since they are in that order within the schema, but that's a nitpick).
Can we please get this PR through? I'm trying to use Terraform with AppSync and this is a blocker for me.
If anyone finds this and wants a hacky solution in the meantime, they can use the following templates to basically imitate the direct resolver pass-through object (taken from this repo): resource "aws_appsync_resolver" "resolver" {
# ...other properties
request_template = <<-EOF
{
"version" : "2017-02-28",
"operation": "Invoke",
"payload": {
"arguments": $util.toJson($ctx.arguments),
"identity": $util.toJson($ctx.identity),
"source": $util.toJson($ctx.source),
"request": $util.toJson($ctx.request),
"prev": $util.toJson($ctx.prev),
"info": {
"selectionSetList": $util.toJson($ctx.info.selectionSetList),
"selectionSetGraphQL": $util.toJson($ctx.info.selectionSetGraphQL),
"parentTypeName": $util.toJson($ctx.info.parentTypeName),
"fieldName": $util.toJson($ctx.info.fieldName),
"variables": $util.toJson($ctx.info.variables)
},
"stash": $util.toJson($ctx.stash)
}
}
EOF
response_template = <<-EOF
$util.toJson($ctx.result)
EOF
} |
* `request_template` - (Optional) The request mapping template for UNIT resolver or 'before mapping template' for PIPELINE resolver. | ||
* `response_template` - (Optional) The response mapping template for UNIT resolver or 'after mapping template' for PIPELINE resolver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It actually might be worth stating that these are only really option if type = "AWS_LAMBDA"
(although there's no code-level check for that atm -- not sure if needed since it should just fail on AWS side during apply
, but nice if we want feedback within terraform). Also might be nice to add an example to the code blocks on this page for "Direct to lambda resolver" or something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree here - we should probably note the requirement for non-Lambda resolvers. 👍
@liamross thank you for development. It is also an issue for me. Can you @mitchellh please accept this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, @shuheiktgw, just going to make these minor adjustments and re-verify 👍
* `request_template` - (Optional) The request mapping template for UNIT resolver or 'before mapping template' for PIPELINE resolver. | ||
* `response_template` - (Optional) The response mapping template for UNIT resolver or 'after mapping template' for PIPELINE resolver. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree here - we should probably note the requirement for non-Lambda resolvers. 👍
@@ -129,6 +127,14 @@ func resourceAwsAppsyncResolverCreate(d *schema.ResourceData, meta interface{}) | |||
} | |||
} | |||
|
|||
if v, ok := d.GetOk("request_template"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, we will also need to do the same in Update
👍
Re-verified 🚀 Output from acceptance testing:
|
This has been released in version 3.38.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! |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Community Note
Closes #14488
Release note for CHANGELOG:
Output from acceptance testing:
Thank you for your review! 👍