Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 1.97 KB

DEVELOPMENT.md

File metadata and controls

50 lines (38 loc) · 1.97 KB

Development

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

Setup

To set up the Datadog-AWS CloudFormation provider, follow the instructions below:

  1. 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
    
  2. Build datadog-cloudformation-common: ​

    # This installs the common package into ~/.m2/repository
    mvn -f datadog-cloudformation-common/pom.xml -Dmaven.test.skip=true install
    
  3. Install cfn-cli.

Testing

  1. Follow the steps in Setup.
  2. cd into the directory of the resource to be tested.
  3. 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.

Development Tips

  • The Create and Update handlers of your resource should call the Read 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.