The Datadog/datadog-cloudformation-resources
repository contains:
- All resources currently implemented for AWS CloudFormation.
- A package with common functionality shared among the Resources -
datadog-cloudformation-common
To set up the Datadog-AWS CloudFormation provider, follow the instructions below:
-
Build [datadog-api-client-java][12]:
git clone [email protected]:DataDog/datadog-api-client-java.git cd datadog-api-client-java # This installs the client into ~/.m2/repository mvn install -Dmaven.test.skip=true
-
Build
datadog-cloudformation-common
: # This installs the common package into ~/.m2/repository mvn -f datadog-cloudformation-common/pom.xml -Dmaven.test.skip=true install
-
Install
cfn-cli
.
- Follow the steps in Setup.
cd
into the directory of the resource to be tested.- Run
mvn test
inside the directory to run the test suite for that resource.
Note: the tests use DD_TEST_CF_API_KEY
, DD_TEST_CF_APP_KEY
and optionally also DD_TEST_CF_API_URL
from environment variables.
-
The
Create
andUpdate
handlers of your resource should call theRead
handler (when the create/update is successful) to return a fully populated model. -
On failure, a handler should return an error message. A success does not return a message. For example:
return ProgressEvent.<ResourceModel, CallbackContext>builder() .resourceModel(model) .status(OperationStatus.FAILED) .message("Failed to read monitor 12345") .build();
-
Primary Identifiers should all be based on required fields. Having optional fields make up this property causes errors on stack creation. These will also be displayed when
Fn:Ref
is called on this resource. -
Using the built in
logger
in the resource displays logs in CloudWatch to help debug any issues.