Skip to content

Commit

Permalink
Periodic doc refresh (#858)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckesser and omkhegde authored Jan 24, 2022
1 parent 1888334 commit bc68113
Show file tree
Hide file tree
Showing 32 changed files with 1,941 additions and 421 deletions.
39 changes: 39 additions & 0 deletions doc_source/contract-tests.md
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\. |
4 changes: 2 additions & 2 deletions doc_source/glossary.md
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*\.
52 changes: 32 additions & 20 deletions doc_source/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CloudFormation Command Line Interface User Guide for Type Development
# CloudFormation Command Line Interface User Guide for Extension Development

-----
*****Copyright &copy; 2019 Amazon Web Services, Inc. and/or its affiliates. All rights reserved.*****
*****Copyright &copy; Amazon Web Services, Inc. and/or its affiliates. All rights reserved.*****

-----
Amazon's trademarks and trade dress may not be used in
Expand All @@ -14,22 +14,34 @@ Amazon's trademarks and trade dress may not be used in

-----
## Contents
+ [What Is the CloudFormation Command Line Interface?](what-is-cloudformation-cli.md)
+ [Creating Resource Providers](resource-types.md)
+ [Setting Up Your Environment for Developing Resource Providers](resource-type-setup.md)
+ [Modeling Resource Providers for Use in AWS CloudFormation](resource-type-model.md)
+ [Resource Provider Schema](resource-type-schema.md)
+ [Developing Resource Providers for Use in AWS CloudFormation Templates](resource-type-develop.md)
+ [Global Parameters](resource-type-cli-global-parameters.md)
+ [init](resource-type-cli-init.md)
+ [generate](resource-type-cli-generate.md)
+ [validate](resource-type-cli-validate.md)
+ [invoke](resource-type-cli-invoke.md)
+ [test](resource-type-cli-test.md)
+ [submit](resource-type-cli-submit.md)
+ [Progress Chaining, Stabilization and Callback Pattern](resource-type-develop-stabilize.md)
+ [Registering Resource Providers for Use in AWS CloudFormation Templates](resource-type-register.md)
+ [Walkthrough: Develop a Resource Provider](resource-type-walkthrough.md)
+ [Resource Provider FAQ](resource-type-faq.md)
+ [What is the CloudFormation Command Line Interface (CLI)?](what-is-cloudformation-cli.md)
+ [Creating resource types](resource-types.md)
+ [Modeling resource types for use in AWS CloudFormation](resource-type-model.md)
+ [Resource type schema](resource-type-schema.md)
+ [Patterns for modeling your resource types](resource-type-howtos.md)
+ [Preventing false drift detection results for resource types](resource-type-model-false-drift.md)
+ [Developing resource types for use in AWS CloudFormation Templates](resource-type-develop.md)
+ [Testing resource types using contract tests](resource-type-test.md)
+ [Resource type handler contract](resource-type-test-contract.md)
+ [Contract tests](contract-tests.md)
+ [Handler error codes](resource-type-test-contract-errors.md)
+ [ProgressEvent object schema](resource-type-test-progressevent.md)
+ [Progress chaining, stabilization and callback pattern](resource-type-develop-stabilize.md)
+ [Walkthrough: Develop a resource type](resource-type-walkthrough.md)
+ [Resource type FAQ](resource-type-faq.md)
+ [Developing modules](modules.md)
+ [Module structure](modules-structure.md)
+ [Develop a module using the CFN-CLI](modules-develop.md)
+ [Registering extensions for use in the CloudFormation registry](resource-type-register.md)
+ [Publishing extensions to make them available for public use](publish-extension.md)
+ [Publishing your extension in multiple Regions using AWS CloudFormation StackSets](publish-extension-stacksets.md)
+ [CloudFormation CLI command reference](resource-type-cli.md)
+ [Global parameters](resource-type-cli-global-parameters.md)
+ [init](resource-type-cli-init.md)
+ [generate](resource-type-cli-generate.md)
+ [validate](resource-type-cli-validate.md)
+ [invoke](resource-type-cli-invoke.md)
+ [test](resource-type-cli-test.md)
+ [submit](resource-type-cli-submit.md)
+ [Document History for User Guide](doc-history.md)
+ [AWS Glossary](glossary.md)
+ [AWS glossary](glossary.md)
35 changes: 35 additions & 0 deletions doc_source/modules-develop.md
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*\.
Loading

0 comments on commit bc68113

Please sign in to comment.