zscholl / terraform-provider-splunk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform provider for Splunk

Requirements

  • Terraform v0.12
  • Go go1.14.4 (to build the provider plugin)

Building The Provider

Clone the repository: https://github.com/splunk/terraform-provider-splunk/

Create go src directory and setup $GOPATH

Build the provider: make build

Developing The Provider

Testing The Provider

  • To run unit tests: make test
  • To run acceptance tests: make testacc
    • Set the following variables to run acceptance tests SPLUNK_HOME, SPLUNK_USERNAME, SPLUNK_URL, SPLUNK_PASSWORD

Using the provider

  • Install Terraform
  • Build the binary by make build
  • Initialize terraform by terraform init
  • Run terraform plan and terraform apply to apply configurations
  • To update run terraform plan first to check config diff
  • For importing existing resources use terraform import
  • To remove all terraform managed resources use terraform destroy

NOTE: When developing or testing with terraform >= 0.13 you must replace the provider location from remote (registry.terraform.io) to local build.

Follow guidelines: https://github.com/hashicorp/terraform/blob/master/website/upgrade-guides/0-13.html.markdown

Contributions

We are open to contributions!

Please follow development guidelines and feel free to open a PR against the `master` branch with your changes. The PR should trigger the GitHub actions to run both the unit and acceptance tests. Once all tests have passed, our team will review, make suggestions, approve, and merge the PR. After merging, our team will update the changelog.MD file and create a version tag that should automatically create a new release.

Examples

  • The examples folder contains a few basic splunk provider examples, run terraform init and terraform apply to apply these example configuration.
  • Resource examples are also available in their respective docs/resources folder

NOTE: Create a resource block first before importing resources (USAGE: https://www.terraform.io/docs/import/usage.html)

Notes and Troubleshooting

  • When conflicts arise during resource creation, import the resource first using terraform import command and make modifications to the resource.
  • Testing errors mentioning too many open files may be related to ulimit on your machine. Check current and increase the maximum number of open files 1024 using ulimit -n 1024
  • If conf files are edited or deleted manually, restart Splunk to ensure state consistency before applying or reapplying a template.
  • Splunk environments with numerous indexes, saved searches, knowledge objects, etc. may cause issues with the provided tests. To avoid these errors, use a fresh or lightly configured Splunk environment.

About

License:Mozilla Public License 2.0


Languages

Language:Go 99.8%Language:Makefile 0.2%Language:HCL 0.0%