Skip to content

Instantly share code, notes, and snippets.

@eelzinaty
Created April 25, 2019 15:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eelzinaty/8d013575a02245aafacaf926226a870d to your computer and use it in GitHub Desktop.
Save eelzinaty/8d013575a02245aafacaf926226a870d to your computer and use it in GitHub Desktop.
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "An auto-generated nested stack.",
"Metadata": {},
"Parameters": {
"AppSyncApiId": {
"Type": "String",
"Description": "The id of the AppSync API associated with this project."
},
"AppSyncApiName": {
"Type": "String",
"Description": "The name of the AppSync API",
"Default": "AppSyncSimpleTransform"
},
"env": {
"Type": "String",
"Description": "The environment name. e.g. Dev, Test, or Production",
"Default": "NONE"
},
"authRoleName": {
"Type": "String",
"Default": "app-authRole"
}
},
"Resources": {
"appsyncexecutionpolicy": {
"Type": "AWS::IAM::Policy",
"Properties": {
"PolicyName": {
"Fn::Sub": [
"appsync-${api}-policy",
{
"api": {
"Ref": "AppSyncApiId"
}
}
]
},
"Roles": [
{
"Ref": "authRoleName"
}
],
"PolicyDocument": {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "customerappsync",
"Effect": "Allow",
"Action": [
"appsync:GraphQL"
],
"Resource": [
{
"Fn::Sub": [
"arn:aws:appsync:${region}:${account}:apis/${appid}",
{
"region": {
"Ref": "AWS::Region"
},
"account": {
"Ref": "AWS::AccountId"
},
"appid": {
"Ref": "AppSyncApiId"
}
}
]
},
{
"Fn::Sub": [
"arn:aws:appsync:${region}:${account}:apis/${appid}/*",
{
"region": {
"Ref": "AWS::Region"
},
"account": {
"Ref": "AWS::AccountId"
},
"appid": {
"Ref": "AppSyncApiId"
}
}
]
},
{
"Fn::Sub": [
"arn:aws:appsync:${region}:${account}:apis/${appid}/types/*",
{
"region": {
"Ref": "AWS::Region"
},
"account": {
"Ref": "AWS::AccountId"
},
"appid": {
"Ref": "AppSyncApiId"
}
}
]
},
{
"Fn::Sub": [
"arn:aws:appsync:${region}:${account}:apis/${appid}/types/*/fields/*",
{
"region": {
"Ref": "AWS::Region"
},
"account": {
"Ref": "AWS::AccountId"
},
"appid": {
"Ref": "AppSyncApiId"
}
}
]
}
]
}
]
}
}
}
},
"Conditions": {
"HasEnvironmentParameter": {
"Fn::Not": [
{
"Fn::Equals": [
{
"Ref": "env"
},
"NONE"
]
}
]
}
},
"Outputs": {
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment