Skip to content

armgit / floci

Public Imported from GitHub
0

Light, fluffy, and always free - The AWS Local Emulator alternative

docs(cloudformation): scope required AppSync resources (#4897)

Mario Toffia233d05eab187
diff --git a/docs/services/appsync.md b/docs/services/appsync.md
index e00b54a71f..f11f57d327 100644
--- a/docs/services/appsync.md
+++ b/docs/services/appsync.md
@@ -499,6 +499,58 @@ Deleting a GraphQL API (`DeleteGraphqlApi`) automatically deletes all child reso
This matches AWS behavior where deleting an API removes its entire configuration.
+## CloudFormation
+
+Floci provisions these AppSync resource types:
+
+| Type | `Ref` returns | `Fn::GetAtt` attributes Floci serves |
+|---|---|---|
+| `AWS::AppSync::GraphQLApi` | the API id (AWS: the API ARN) | `ApiId`, `Arn`, `GraphQLUrl`, `GraphQLDns`, `RealtimeUrl`, `RealtimeDns` |
+| `AWS::AppSync::GraphQLSchema` | `<ApiId>GraphQLSchema` | `Id` (AWS rejects it, see below) |
+| `AWS::AppSync::DataSource` | the data source ARN | `DataSourceArn`, `Name` |
+| `AWS::AppSync::FunctionConfiguration` | the function ARN | `FunctionArn`, `FunctionId`, `Name`, `DataSourceName` |
+| `AWS::AppSync::Resolver` | the resolver ARN | `ResolverArn`, `TypeName`, `FieldName` |
+| `AWS::AppSync::ApiKey` | the key id, `da2-...` (AWS: the key ARN) | `ApiKey`, `ApiKeyId`, `Arn` |
+
+One template with all six types (an API with `API_KEY` plus `AWS_IAM` auth, `LogConfig`,
+`XrayEnabled`, an inline schema, an `AWS_LAMBDA` data source, a direct Lambda resolver, an
+`APPSYNC_JS` resolver, a function and an API key) was deployed to AWS and to Floci, and so was a
+`GraphQLApi` with `AMAZON_COGNITO_USER_POOLS` default auth and a `UserPoolConfig`. Every resource
+reached `CREATE_COMPLETE` on both, and the auth, `LogConfig` and `XrayEnabled` settings
+`GetGraphqlApi` returns afterwards are the same. `Ref` and `Fn::GetAtt` agree except for these
+differences:
+
+- `Ref` on a `GraphQLApi` returns the API id. AWS returns the API ARN, the value of
+ `Fn::GetAtt Arn`. Use `Fn::GetAtt ApiId` or `Fn::GetAtt Arn` to get the same value on both.
+- `Ref` on an `ApiKey` returns the key id. AWS returns the key ARN,
+ `arn:<partition>:appsync:<region>:<account>:apis/<apiId>/apikeys/<keyId>`, the value of
+ `Fn::GetAtt Arn`. `ApiKey` and `ApiKeyId` are the same `da2-` string on both.
+- `GraphQLEndpointArn` is not modeled. `Fn::GetAtt` on it resolves to the literal string
+ `<LogicalId>.GraphQLEndpointArn` and the stack still completes. AWS returns
+ `arn:<partition>:appsync:<region>:<account>:endpoints/graphql-api/<id>`.
+- `GraphQLUrl` and `RealtimeUrl` point at Floci: `<base-url>/v1/apis/<apiId>/graphql` and the
+ matching WebSocket URL ending in `/graphql/realtime`. `GraphQLDns` and `RealtimeDns` are the
+ host of `base-url`. AWS returns `https://<id>.appsync-api.<region>.amazonaws.com/graphql` and
+ `wss://<id>.appsync-realtime-api.<region>.amazonaws.com/graphql`, where `<id>` is not the API id.
+ Floci does not serve the realtime endpoint.
+- `Fn::GetAtt` on a `GraphQLSchema`'s `Id` resolves to the same value as `Ref`. AWS refuses the
+ template with `Resource type AWS::AppSync::GraphQLSchema does not support attribute {Id}`.
+- Generated ids differ in format: a function id is 7 characters on Floci and 26 on AWS.
+
+An `UpdateStack` that changes the API `Name` and one resolver's `Code` updates both in place on
+AWS and on Floci: every id and ARN stays the same and no other resource is touched. Deleting the
+stack removes every resource.
+
+A `GraphQLSchema` with `DefinitionS3Location` and no inline `Definition`, and `CodeS3Location` on
+a `Resolver` or `FunctionConfiguration`, fail the resource with `ValidationError`. Give the schema
+inline in `Definition` and the code inline in `Code`.
+
+`AWS::AppSync::Api`, `ApiCache`, `ChannelNamespace`, `DomainName`, `DomainNameApiAssociation`,
+`SourceApiAssociation` and `Type` are not provisioned. By default such a resource is stubbed: it
+reaches `CREATE_COMPLETE` and nothing is created for it. Set
+`allow-stub-unsupported-resource-types` to `false` to fail it instead, see
+[CloudFormation](cloudformation.md#supported-resource-types).
+
## Not Implemented
These AWS AppSync capabilities are not yet implemented and are tracked in future phases:
diff --git a/docs/services/cloudformation.md b/docs/services/cloudformation.md
index b1f98228ca..9df1c61eb1 100644
--- a/docs/services/cloudformation.md
+++ b/docs/services/cloudformation.md
@@ -147,7 +147,7 @@ cross-resource references.
| Cloud Map | `HttpNamespace`, `PrivateDnsNamespace`, `PublicDnsNamespace`, `Service` |
| API Gateway (v1) | `RestApi`, `Resource`, `Authorizer`, `Method`, `Deployment`, `Stage`, `Account`, `DomainName`, `BasePathMapping`, `GatewayResponse`, `ApiKey`, `UsagePlan`, `UsagePlanKey` |
| API Gateway v2 | `Api`, `Authorizer`, `Route`, `Integration`, `Stage`, `Deployment`, `VpcLink` |
-| AppSync | `GraphQLApi`, `GraphQLSchema`, `DataSource`, `FunctionConfiguration`, `Resolver`, `ApiKey` |
+| AppSync | `GraphQLApi`, `GraphQLSchema`, `DataSource`, `FunctionConfiguration`, `Resolver`, `ApiKey`. `Ref` on `GraphQLApi` and `ApiKey` returns the id where AWS returns the ARN. See [AppSync](appsync.md#cloudformation) for `Ref` and `Fn::GetAtt` compared with AWS. |
| Step Functions | `StateMachine` |
| CodePipeline | `Pipeline`, `CustomActionType`, `Webhook` |
| CodeBuild | `Project` |
diff --git a/tools/docs/cfn_resource_types.yaml b/tools/docs/cfn_resource_types.yaml
index 6073905597..1cda557bcd 100644
--- a/tools/docs/cfn_resource_types.yaml
+++ b/tools/docs/cfn_resource_types.yaml
@@ -182,6 +182,9 @@ notes:
# Trailing prose appended to a row after its type list, for behaviour that belongs to the service
# rather than to one type.
row_notes:
+ AWS::AppSync: >-
+ `Ref` on `GraphQLApi` and `ApiKey` returns the id where AWS returns the ARN. See
+ [AppSync](appsync.md#cloudformation) for `Ref` and `Fn::GetAtt` compared with AWS.
AWS::Lambda: >-
Inline `ZipFile` packages include the `cfn-response` (Node.js) / `cfnresponse` (Python) module
AWS injects for that code path, so Solutions-style custom-resource handlers work.