Prototype which adopts a flat, modular approach to generating resources at scale for multiple accounts using New Relic's Terraform provider without any dependencies.
- Terraform ~> 1.0
- New Relic Provider ~> 2.0
- Clone the repository.
- Access terraform.tfvars.json.
- Replace
account_id
,api_key
, and (optionally)alias
with your accounts' data. - Initialise Terraform with latest provider:
terraform init -upgrade
. - Apply configuration with placeholder data:
terraform apply -auto-approve -compact-warnings
.
- For a flat structure, shared configurations are prefixed
shared--
at the root of the directory.- This removes the need for external wrappers, such as Terragrunt.
- Each account requires an alias in order to pass its associated
account_id
into referenced modules viaproviders
.
- Each module is located in its own subdirectory to:
- Encourage reusability: keeping code DRY.
- Prevent conflict of duplicate entity names.
- Modules are paired with a generic
versions.tf
which inherits version details from the root to remain flexible for upgrades.
Module | Description | Input | Output |
---|---|---|---|
apm_alert | APM alert policies and associated NRQL conditions. | Account alias, runbook URL and channel IDs. | None. |
channel | Alert notification channels. | None. | Channel IDs. |
dashboard | Dashboard. | Account alias. | Dashboard URL. |
synthetic | Synthetic monitors and associated multilocation alert conditions. | Account alias, runbook URL, channel IDs, and endpoints. | None. |
- For general queries about the developer toolkit, New Relic Explorers Hub is a good starting point.
- For specific queries about New Relic's Terraform provider, newrelic/terraform-provider-newrelic is your best bet.
- Synthetic multilocation alert condition is changed on every run.
- Workaround: Add
lifecycle { ignore_changes = [entities] }
to the resource to ignore changes.
- Workaround: Add
Pull requests are welcome and appreciated. For major contributions, please open an issue to discuss what you would like to change.
GNU Affero General Public License v3.0
Neither myself nor this project are associated with New Relic™.
All works herein are my own and shared of my own volition.
Copyleft @ All wrongs reserved.