GS2-Deploy template file specification
This is the format specification of the template file used when creating a stack in GS2-Deploy. It can be written in JSON or YAML format.
Types of sections
A template consists of the following sections.
Section | Required | Description |
---|---|---|
GS2TemplateFormatVersion | ✓ | Specifies the format of the template. Currently only 2019-05-01 can be defined. |
Description | You can fill in the description and other information about the template. | |
Globals | This section defines the Alias attribute (string replacement specification). | |
Resources | ✓ | Define resources for each GS2 service to be included in the stack. |
Outputs | Defines the output values to be displayed in the management console. |
GS2TemplateFormatVersion: "2019-05-01"
Description: GS2-Account initialize template Version 2021-12-03
Globals:
Alias:
AccountNamespaceName: game-0001
KeyNamespaceAccountAuthentication: account-encryption-key-namespace
KeyAccountAuthentication: account-encryption-key
GatewayNamespaceName: gateway-0001
Resources:
GatewayNamespace:
Type: GS2::Gateway::Namespace
Properties:
Name: ${GatewayNamespaceName}
KeyNamespaceAccountAuthentication:
Type: GS2::Key::Namespace
Properties:
Name: ${KeyNamespaceAccountAuthentication}
KeyAccountAuthentication:
Type: GS2::Key::Key
Properties:
NamespaceName: ${KeyNamespaceAccountAuthentication}
Name: ${KeyAccountAuthentication}
DependsOn:
- KeyNamespaceAccountAuthentication
AccountNamespace:
Type: GS2::Account::Namespace
Properties:
Name: ${AccountNamespaceName}
Outputs:
AccountNamespaceName: !GetAttr AccountNamespace.Item.Name
KeyAccountAuthenticationKeyId: !GetAttr KeyAccountAuthentication.Item.KeyId
GatewayNamespaceName: !GetAttr GatewayNamespace.Item.Name
Globals
Alias
Replaces strings in the Resources and Outputs sections with the specified string. Replace the string on the left side with ${…} The string on the right side is replaced by the string on the left side, enclosed in ${}, as in the following example.
Example of replacement specification: ${AccountNamespaceName}
Globals:
Alias:
AccountNamespaceName: game-0001
Resources
Defines the resource to be generated, with Type and Properties attributes, and DependsOn attribute if necessary.
Resources:
KeyNamespaceAccountAuthentication: # Name of the resource definition.
Type: GS2::Key::Namespace # Specify resource
Properties:
Name: ${KeyNamespaceAccountAuthentication}
KeyAccountAuthentication: # Name of resource definition
Type: GS2::Key::Key # Specify resource
Properties:
NamespaceName: ${KeyNamespaceAccountAuthentication}
Name: ${KeyAccountAuthentication}
DependsOn: # Specify the name of the dependent resource definition
- KeyNamespaceAccountAuthentication # Depends on KeyNamespaceAccountAuthentication creation
AccountNamespace: # Name of the resource definition
Type: GS2::Account::Namespace # Specify resource
Properties:
Name: ${AccountNamespaceName}
Type
Specifies resources to be generated for the service. Specify the entity name from the GS2-Deploy reference page for each service.
Example: Type: GS2::Account::Namespace
.
Properties
Specify the value to be given to the property value when the resource is created.
DependsOn
Specifies the name of a dependent resource so that the resource will be created following other resources.
Outputs
Defines the output values that will hold the value and allow the value to be viewed later, e.g., through the management console.
Outputs:
AccountNamespaceName: !GetAttr AccountNamespace.Item.Name
KeyAccountAuthenticationKeyId: !GetAttr KeyAccountAuthentication.Item.KeyId
GatewayNamespaceName: !GetAttr GatewayNamespace.Item.Name
Functions
Functions are available in GS2-Deploy templates.
!GetAttr
The !GetAttr tag can be used to retrieve the property values of the generated results for each resource.
In this example, GS2::Account::Namespace is specified in AccountNamespace, so Namespace is generated in GS2-Account. The result is retrieved in AccountNamespace, and the NameSpace model is stored in AccountNamespace.Item. GetAttr AccountNamespace.Item.
GetAttr tag is assigned the following as reserved words, and the values can be retrieved.
Key Value | Type | Description |
---|---|---|
Gs2::Region | string | Region type |
Gs2::OwnerId | string | Owner ID |
AccountNamespace:
Type: GS2::Account::Namespace
Properties:
Name: ${AccountNamespaceName}
Outputs:
AccountNamespaceName: !GetAttr AccountNamespace.Item.Name
!Join
The !Join tag concatenates the strings in the following array. A delimiter (delimiter) can be specified.
Format: !Join [ specify delimiter, [list of strings to concatenate]]
QueueNamespace:
Type: GS2::JobQueue::Namespace
Properties:
Name: ${QueueNamespaceName}
PushNotification:
GatewayNamespaceId: !Join
- ':'
- - 'grn'
- 'gs2'
- !GetAttr Gs2::Region
- !GetAttr Gs2::OwnerId
- 'gateway'
- ${GatewayNamespaceName}