Skip to content

CloudFormation Template Schema upgrade #2

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

Merged
merged 1 commit into from
Mar 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
106 changes: 106 additions & 0 deletions schema/base.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://aws.amazon.com/cloudformation/template/base",
"type": "object",
"definitions": {
"Transform": {
"type": "object",
"oneOf": [
{
"$comment": "You can use the AWS::Include transform anywhere within the AWS CloudFormation template except in the template parameters section or the template version field. For example, you can use AWS::Include in the mappings section.",
"properties": {
"Name": {
"type": "string",
"enum": [
"AWS::Include"
]
},
"Parameters": {
"type": "object",
"properties": {
"Location": {
"$comment": "The location is an Amazon S3 URI, with a specific file name in an S3 bucket. For example, s3://MyBucketName/MyFile.yaml.",
"type": "string",
"format": "uri"
}
},
"additionalProperties": false
}
},
"additionalProperties": false
},
{
"$comment": "Use a transform to simplify template authoring for serverless applications. ",
"type": "string",
"enum": [
"AWS::CodeDeployBlueGreen",
"AWS::CodeStar",
"AWS::SecretsManager-2020-07-23",
"AWS::Serverless-2016-10-31"
]
}
]
}
},
"additionalProperties": false,
"properties": {
"AWSTemplateFormatVersion": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/format-version-structure.html",
"type": "string",
"enum": [
"2010-09-09"
]
},
"Description": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/template-description-structure.html",
"type": "string",
"maxLength": 1024
},
"Metadata": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html",
"type": "object"
},
"Parameters": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/parameters-section-structure.html",
"$ref": "parameters.schema.json#/properties/Parameters"
},
"Mappings": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/mappings-section-structure.html",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]{1,255}$": {
"$ref": "mappings.schema.json#/properties/Mappings"
}
},
"additionalProperties": false
},
"Conditions": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html",
"$ref": "conditions.schema.json#/properties/Conditions"
},
"Transform": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/transform-section-structure.html",
"$ref": "#/definitions/Transform"
},
"Outputs": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/outputs-section-structure.html",
"type": "object"
},
"Resources": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resources-section-structure.html",
"$ref": "resources.schema.json#/properties/Resources"
},
"Hooks": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/blue-green.html",
"type": "object"
},
"Rules": {
"description": "https://docs.aws.amazon.com/servicecatalog/latest/adminguide/reference-template_constraint_rules.html",
"type": "object"
}
},
"description": "CloudFormation template JSON specification",
"required": [
"Resources"
]
}
113 changes: 113 additions & 0 deletions schema/conditions.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://aws.amazon.com/cloudformation/template/conditions",
"title": "Conditions",
"description": "CloudFormation template JSON specification for the Conditions capability",
"type": "object",
"definitions": {
"ConditionalExpression": {
"$comment": "Intrinsic function token expression or literal value",
"anyOf": [
{
"$comment": "Literal value",
"type": "string"
},
{
"$ref": "#/definitions/FnAnd"
},
{
"$ref": "#/definitions/FnEquals"
},
{
"$ref": "#/definitions/FnNot"
},
{
"$ref": "#/definitions/FnOr"
},
{
"$ref": "intrinsics.schema.json#/definitions/FnFindInMap"
},
{
"$ref": "#/definitions/FnRef"
}
]
},
"FnRef": {
"type": "string"
},
"FnAnd": {
"type": "object",
"properties": {
"Fn::And": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-and",
"type": "array",
"items": {
"$ref": "#/definitions/ConditionalExpression"
},
"minItems": 2,
"maxItems": 10
}
},
"additionalProperties": false
},
"FnEquals": {
"type": "object",
"properties": {
"Fn::Equals": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-equals",
"type": "array",
"items": {
"$ref": "#/definitions/ConditionalExpression"
},
"minItems": 2,
"maxItems": 2
}
},
"additionalProperties": false
},
"FnNot": {
"type": "object",
"properties": {
"Fn::Not": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-not",
"type": "array",
"items": [
{
"$ref": "#/definitions/ConditionalExpression"
}
],
"minItems": 1,
"maxItems": 1
}
},
"additionalProperties": false
},
"FnOr": {
"type": "object",
"properties": {
"Fn::Or": {
"description": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-conditions.html#intrinsic-function-reference-conditions-or",
"type": "array",
"items": {
"$ref": "#/definitions/ConditionalExpression"
},
"minItems": 2,
"maxItems": 10
}
},
"additionalProperties": false
}
},
"properties": {
"Conditions": {
"$comment": "You can use intrinsic functions, such as Fn::If, Fn::Equals, and Fn::Not, to conditionally create stack resources. These conditions are evaluated based on input parameters that you declare when you create or update a stack. After you define all your conditions, you can associate them with resources or resource properties in the Resources and Outputs sections of a template.",
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]{1,255}$": {
"$ref": "#/definitions/ConditionalExpression"
}
},
"additionalProperties": false
}
}
}
Loading