This is a Terraform provider to codify SignalFx detectors, charts and dashboards, thereby making it easier to create, manage and version control them.
This provider was originally created and maintained by Yelp for years before being taken over as an official SignalFx project. It also contains contributions from a fork maintained by Stripe. Thanks, folks to Yelp and Stripe for their work!
This provider has the following configuration options:
auth_token
(required) - The auth token for authenticationapi_url
- The API URL to use for communicating with SignalFx. This is helpful for organizations who need to set their Realm or use a proxy. Note: You likely want to changecustom_app_url
too!custom_app_url
- The application URL that users should use to interact with assets in the browser. This is used by organizations using specific realms or those with a custom SSO domain.
To build the go binary from source:
go build
The output binary will be named terraform-provider-signalfx
.
If you want to customize your target platform set the GOOS
and GOARCH
environment variables; e.g.:
GOOS=darwin GOARCH=amd64 make build
Once you have built the binary, place it in the your terraform installation for it to be available everywhere. For local use, this is usually ~/.terraform.d/plugins
.
To make a new release:
- Decide on the next version, use semantic versioning
- Edit
CHANGELOG.md
and make sure all the goodies are in it! git commit
git tag v<VERSION>
git push origin master && git push origin --tags
Everyone is encouraged to contribute to terraform-provider-signalfx
. You can contribute by forking the GitHub repo and making a pull request or opening an issue.
To run the tests, run go test ./...
This provider because the official SignalFx provider at the time of SignalForm v2.8.0. Conversions from SignalForm to this module at that point in time have no compatibility issues.
To perform a conversion you'll need to do two things:
- adjust the provider configuration
- change Terraform configuration files to references the new provider name
- update state files to reference the new provider name
Each are easy to do! You'll need to do them at the same time, however, avoiding any asset changes between each step.
The SignalForm provider is configured like:
provider "signalform" {
auth_token = "XXX"
}
You'll need to change the name from signalform
to signalfx
wherever you've set this up in your file layout.
This should be a straight-forward search and replace, but please mind that you may have some naming conventions in your install for which the following instructions don't work. Double check everything!
All of the SignalForm resources look like signalform_…
. You'll want to search and replace this string with signalfx_…"
. You can do this in a code editor or on the command line with something like:
- OS X:
find . -regex ".*\.tf" -type f -exec sed -i '' 's/signalform_/signalfx_/' {} +
- GNU
sed
, like Linux:find . -regex ".*\.tf" -type f -exec sed -i s/signalform_/signalfx_/' {} +
This should handle replacing all resource definitions as well as references to those resources.
To cap it off, run terraform init
.
First, make a backup of your state file just in case.
Note: Terraform state files are friendly to command lines. You may choose another way to migrate that doesn't use terraform state mv
and instead modifies the file directly. Using the process below fits Terraform's advice wherein they "we recommend piping Terraform state subcommands together with other command line tools". It also works with remote state files.
The state files in Terraform now need to be updated to use the new provider name. We can first find a list of all resources in the state file:
$ terraform state list
signalform_dashboard.mydashboard0
signalform_dashboard_group.mydashboardgroup0
signalform_time_chart.mychart0
Just like our configuration, we're just changing signalform_
to signalfx_
. Here's a bit of Bash to do that (remove the wrapping echo
to run it):
#!/bin/bash
for resource in $(terraform state list); do
if [[ $resource == *"signalform_"* ]]; then
newresource=$(echo $resource | sed 's/signalform_/signalfx_/')
echo "terraform state mv $resource $newresource"
fi
done
When run, you should see something like:
Moved signalform_dashboard.mydashboard0 to signalfx_dashboard.mydashboard0
Moved signalform_dashboard_group.mydashboardgroup0 to signalfx_dashboard_group.mydashboardgroup0
Moved signalform_time_chart.mychart0 to signalfx_time_chart.mychart0
After that we can run a terraform plan
to ensure everything is unchanged:
…
No changes. Infrastructure is up-to-date.
…
What is SignalForm?
Yelp helpfully created and maintained this provider for years, then allowed SignalFx to take it over as our official provider. Thanks, Yelp! This provider was called SignalForm then. You should use this one now!
Can I use the UI to help me?
Sure! Any given a chart or detector created from the UI, you can see its representation in Signalflow from the Actions menu: