-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Periodic doc refresh Bring docs up-to-date with https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/what-is-cloudformation-cli.html#resource-type-setup Co-authored-by: Omkar Hegde <[email protected]>
- Loading branch information
Showing
32 changed files
with
1,941 additions
and
421 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Contract tests<a name="contract-tests"></a> | ||
|
||
As part of testing your resource, the CloudFormation CLI performs a suite of tests, each written to test a requirement contained in the [resource type handler contract](resource-type-test-contract.md)\. Each handler invocation is expected to follow the general requirements for that handler listed in the contract\. This topic lists tests that explicitly test some of the more specific requirements\. | ||
|
||
## `create` handler tests<a name="contract-tests-create"></a> | ||
|
||
The CloudFormation CLI performs the following contract tests for `create` handlers\. | ||
|
||
|
||
| Test | Description | | ||
| --- | --- | | ||
| **contract\_create\_create** | Creates a resource, waits for the resource creation to complete, and then creates the resource again with the expectation that the second create operation will fail with the `AlreadyExists` error code\. This test is not run for resources if the primary identifier or any additional identifiers are read\-only\. | | ||
| **contract\_create\_read** | Creates a resource, waits for the resource creation to complete, and then reads the created resource to ensure that the input to the `create` handler is equal to the output from the `read` handler\. The comparison ignores any read\-only/generated properties in the `read` output, as create input cannot specify these\. It also ignores any write\-only properties in the create input, as these are removed from read output to avoid security issues\. | | ||
| **contract\_create\_delete** | Creates a resource, waits for the resource creation to complete, and then deletes the created resource\. It also checks if the create input is equal to the create output \(which is then used for delete input\), with the exception of readOnly and writeOnly properties\. | | ||
| **contract\_create\_list** | Creates a resource, waits for the resource creation to complete, and then lists out the resources with the expectation that the created resource exists in the returned list\. | | ||
|
||
## `update` handler tests<a name="contract-tests-update"></a> | ||
|
||
The CloudFormation CLI performs the following contract tests for `update` handlers\. | ||
|
||
|
||
| Test | Description | | ||
| --- | --- | | ||
| **contract\_update\_read** | Creates a resource, updates the resource, and then reads the resource to check that the update was made by comparing the read output with the update input\. The comparison excludes read\-only and write\-only properties because they cannot be included in the update input and read output, respectively\. | | ||
| **contract\_update\_list** | Creates a resource, updates the resource, and then lists the resource to check that the updated resource exists in the returned list\. | | ||
| **contract\_update\_without\_create** | Updates a resource without creating it first\. The test expects the update operation to fail with the `NotFound` error code\. | | ||
|
||
## `delete` handler tests<a name="contract-tests-delete"></a> | ||
|
||
The CloudFormation CLI performs the following contract tests for `delete` handlers\. | ||
|
||
|
||
| Test | Description | | ||
| --- | --- | | ||
| **contract\_delete\_create** | Creates a resource, deletes the resource, and then creates the resource again with the expectation that the deletion was successful and a new resource can be created\. The CloudFormation CLI performs this contract test for resources with create\-only primary identifiers\. | | ||
| **contract\_delete\_update** | Creates a resource, deletes the resource, and then updates the resource with the expectation that the update operation will fail with the `NotFound` error code\. | | ||
| **contract\_delete\_read** | Creates a resource, deletes the resource, and then reads the resource with the expectation that the read operation will fail with the `NotFound` error code\. | | ||
| **contract\_delete\_list** | Creates a resource, deletes the resource, and then lists the resource with the expectation that the returned list does not contain the deleted resource\. | | ||
| **contract\_delete\_delete** | Creates a resource, deletes the resource, and then deletes the resource again with the expectation that the second delete operation will fail with the `NotFound` error code\. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# AWS Glossary<a name="glossary"></a> | ||
# AWS glossary<a name="glossary"></a> | ||
|
||
For the latest AWS terminology, see the [AWS Glossary](https://docs.aws.amazon.com/general/latest/gr/glos-chap.html) in the *AWS General Reference*\. | ||
For the latest AWS terminology, see the [AWS glossary](https://docs.aws.amazon.com/general/latest/gr/glos-chap.html) in the *AWS General Reference*\. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Develop a module using the CFN\-CLI<a name="modules-develop"></a> | ||
|
||
Follow these basic steps to develop and register a module project\. | ||
|
||
1. In the CFN\-CLI, use the `[init](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-init.html)` command to create a new project\. The `init` command creates a `fragments` folder containing a sample fragment file named `sample.json`\. | ||
|
||
Follow the prompts\. Specify that you want to create a **module\(m\)**, and enter the module name\. | ||
|
||
``` | ||
cfn init | ||
Initializing new project | ||
Do you want to develop a new resource(r) or a module(m)?. | ||
>> m | ||
What is the name of your module type? | ||
(<Organization>::<Service>::<Name>::MODULE) | ||
>> My::Sample::SampleBucket::MODULE | ||
``` | ||
|
||
1. Include your template fragment in the project\. | ||
|
||
In the `fragments` folder in the project, you should find a file named `sample.json`\. This is the template fragment file\. Author your template fragment in this file and save\. | ||
|
||
You can rename this file as necessary\. The folder can only contain a single file\. | ||
|
||
For more information, see [Creating a module template fragment](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/modules-structure.html#modules-template-fragment)\. | ||
|
||
1. Use `[validate](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-validate.html)` to validate your project\. Fix any issues reported\. | ||
|
||
The `validate` command regenerates the module schema, based on the template fragment you included in the `fragments` folder\. The module schema is located in the root folder, and named `schema.json`\. | ||
|
||
1. Use `[submit](https://docs.aws.amazon.com/cloudformation-cli/latest/userguide/resource-type-cli-submit.html)` to register the module with CloudFormation, in the specified region\. Registering a module makes it available for inclusion in CloudFormation templates\. | ||
**Note** | ||
When you register your module using `submit`, CloudFormation re\-generates your module schema based on the template fragment in your project\. You can't specify a schema file directly\. To specify a module schema file when registering a module, use `[RegisterType](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_RegisterType.html)` in the CloudFormation API\. | ||
|
||
For information on using modules in CloudFormation templates, see [Using modules](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/modules.html) in the *CloudFormation Users Guide*\. |
Oops, something went wrong.