cd /path/terraform-provider-conformitygo mod tidy
go mod vendor# ...
VERSION=0.6 # Set a new version
OS_ARCH=darwin_amd64 # Update to value that matches with your OS
# ...make installterraform {
required_providers {
conformity = {
version = "YOUR_VERSION"
# Set path to match with values in HOSTNAME/NAMESPACE/NAME defined in the Makefile
source = "trendmicro.com/cloudone/conformity"
}
}
}cd example/path-to-main/
terraform init
terraform applyNotes:
- for your own config, create a file name
terraform.tfvars - add the following:
region = "region"
apikey = "apikey"Turn on debug:
export TF_LOG_CORE=TRACE
export TF_LOG_PROVIDER=TRACE- when you are testing, you can set environment variable
CONFORMITY_API_URLto match your testing API url; otherwise it will use default official API url.
- Make sure you installed the "Go for Visual Studio Code" extension which will install the golang debug tool
dlvfor you - Make sure you created the correct section in
.vscodelaunch.json
{
"name": "Debug - Attach External CLI",
"type": "go",
"request": "launch",
"mode": "debug",
// this assumes your workspace is the root of the repo
"program": "${workspaceFolder}",
"internalConsoleOptions": "openOnSessionStart",
"env": {},
"args": [
// pass the debug flag for reattaching
"-debug",
],
}- Before you start debugging you need update some files:
- Update the getUrl function in pkg/cloudconformity/client.go to make it return the API endpoint you want to test with for example:
return "https://ap-southeast-2-development.cloudconformity.com/api/", nil- Make sure your test template uses provider config
terraform {
required_providers {
conformity = {
source = "trendmicro/conformity"
...
}
}
}- Start debugging in vscode
- Look at the vscode "DEBUG CONSOLE", the dlv will output the TF_REATTACH_PROVIDERS environment variable
- Set the breakpoints and run
terrafromcommands in the terminal
Create a file name terraform.tfvars and add all necessary variables here
Ensure terraform.tfvars is included in .gitignore so these secrets are not accidentally pushed to a remote git repository.
Terraform provides a way of reading variables from the environment: https://www.terraform.io/docs/cli/config/environment-variables.html#tf_var_name
Use the Doc Preview Tool to understand how the markdown will look once released. The Provider Documentation can also provide further guidance.
1. Go to terraform provider GitHub: https://github.com/trendmicro/terraform-provider-conformity/releases
3. Click "Choose a Tag" dropdown, provide tag with value “xxx”, then select "+ Create new Tag : xxx on publish" popup item below.
6. Add the released changes to the description. Do avoid Jira Ticket's IDs as those are not publicly visible.
After releasing, a webhook will be sent to Terraform registry automatically. Within about 10 minutes https://registry.terraform.io/providers/trendmicro/conformity/latest/docs should be updated with the new release from Github.
