github.com/GoogleCloudPlatform/terraformer@v0.8.18/tests/datadog/README.md (about)

     1  # Testing the Datadog provider 
     2  
     3  The CLI script provided is used to test importing Datadog resources with terraformer. The tool will create resources using Terraform CLI and import them using terraformer. The imported resources will be stored in the `generated/` directory.
     4  
     5  _Note_: The script will create and destroy real resources. Never run this on a production Datadog organization.
     6  
     7  ### Requirements 
     8  * terraform version >= 0.12.x
     9  
    10  ### Script usage
    11  
    12  **Terraform 0.12.x**
    13  
    14  Run the script from the projects root directory:
    15  
    16  ```
    17  go run ./tests/datadog/
    18  ``` 
    19  
    20  - Test should run successfully without exiting
    21  
    22  **Terraform 0.13.x**
    23  
    24  Run the script from the projects root directory and pass the terraform version using DATADOG_TF_VERSION env var:
    25  
    26  ```
    27  DATADOG_TF_VERSION=0.13.x LOG_CMD_OUTPUT=true go run ./tests/datadog/
    28  ```
    29  - Terraformer currently generates resources using terraform version 0.12.29 and HCLv1 standards. When using terraform version 0.13.x, the script will fail due to `outputs` diffs when running `terraform plan` on the generated resources. This is due to differences in how outputs are references in state files.
    30  
    31  - Manually ensure that generated diffs are regarding outputs only. E.g:
    32  
    33  ```
    34  Plan: 0 to add, 0 to change, 0 to destroy.
    35  
    36  Changes to Outputs:
    37      ~ datadog_dashboard_tfer--dashboard_gwh-002D-a7r-002D-cfs_id = "<resource-ID>" -> "datadog_dashboard.tfer--dashboard_gwh-002D-a7r-002D-cfs.id"
    38  ```
    39  
    40  ##### Available configuration options
    41  
    42  | Configuration Options     | Description        |
    43  | -------------             |:-------------      |
    44  | **DD_TEST_CLIENT_API_KEY**    | Datadog api key      |
    45  | **DD_TEST_CLIENT_APP_KEY**    | Datadog APP key      |
    46  | **DATADOG_HOST**              | The API Url. if you're working with "EU" version of Datadog, use `https://api.datadoghq.eu/`. Default: `https://api.datadoghq.com/`      |
    47  | **DATADOG_TF_VERSION**        | Terraform version installed. Pass the terraform version number if using Terraform version >= 0.13.x      |
    48  | **DATADOG_TERRAFORM_TARGET**    | Colon separated list of resource addresses to [target](https://www.terraform.io/docs/commands/plan.html#resource-targeting). Example: `DATADOG_TERRAFORM_TARGET="datadog_dashboard.free_dashboard_example:datadog_monitor.monitor_example"`      |
    49  | **LOG_CMD_OUTPUT**    | Print outputs to stderr and stdout when running `terraform` commands. Default `false`      |
    50  
    51  **Frequently Asked Questions**
    52  
    53  ```
    54  2020/10/26 15:08:34 Message: Error while importing resources. Error: fork/exec : no such file or directory
    55  ```
    56  - Above error indicates that Terraformer is unable to locate the datadog provider executable. Manually pass the dir of the plugin's directory using env var `TF_PLUGIN_DIR`. E.g. `TF_PLUGIN_DIR=~/.terraform.d/`