Closed andrew-aernos closed 5 years ago
@andrew-aernos Are you looking to add the S3DeploymentBucket and S3DeploymentRootKey within the resolver? If so then one option would be to add these values inline when creating the resolver.
"RequestMappingTemplate": {
"Fn::Sub": [
{ "Fn::Join": [
"\n",
[
"#set($S3DeploymentBucket = ${S3DeploymentBucket}",
"#set($S3DeploymentRootKey = ${S3DeploymentRootKey}"
"...rest of vtl logic..."
]
]},
{
"S3DeploymentBucket": {
"Ref": "S3DeploymentBucket"
},
"S3DeploymentRootKey": {
"Ref": "S3DeploymentRootKey"
}
}
]
}
Feel free to reopen/comment if you have further questions.
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Which Category is your question related to? Amplify CLI custom categories and resources
What AWS Services are you utilizing? Amplify, AppSync GraphQL custom resolvers, Cloudformation
Provide additional details e.g. code snippets Amplify version 3.9.0 Following the guidelines here https://aws-amplify.github.io/docs/cli-toolchain/quickstart#custom-cloudformation-stacks
My CustomResources.json is getting out of hand with all the custom resolvers, appsync datasource, the underlying dynamodb/lambda and its required iam service roles. I don't really know what is the best practice for managing this. The dependency is illustrated below:
Approach 1 - Package by type Define custom categories and resources, and defined dependsOn in the backend-config.json
Problem with this approach: I'm stuck trying to get "S3DeploymentBucket" and "S3DeploymentRootKey" needed for the Resolvers. One weird way I'm trying is to get them output from the api's nested stack in stakcs/CustomResources.json but I can't seem to find documentation on how to reference output from a nested stack.
Approach 2 Package-by-feature Much more ideal and scalable, for each new feature it can independently define its own set of dependencies, datasource type and resolvers. for ex. User
Problem with this pattern is currently as of amplify 3.9.0, the appsync service doesn't bundle up everything and upload all the assets, making nested-stack reference impossible if it is organized this way by the developer client. Is there is a way to hook into the appsync service build process to have it bundle everything and load the asset to S3 ???
I'm short of just flattening the package-by-feature pattern to prefixes, which to me would be another absolute hell to deal with.