/terraform-provider-site24x7

Terraform provider for Site24x7

Primary LanguageGoMIT LicenseMIT

Terraform logo

Site24x7 Terraform Provider

The Terraform Site24x7 provider is a plugin for Terraform that allows for the full lifecycle management of Site24x7 resources. This provider is maintained by Site24x7 team.

Please note: If you believe you have found a security issue in the Terraform Site24x7 Provider, please responsibly disclose by contacting us at support@site24x7.com.

Requirements

Using the provider

To use the latest version of the provider in your Terraform environment, run terraform init and Terraform will automatically install the provider.

For Terraform version 0.13.x

terraform {
  required_version = "~> 0.15.0"
  required_providers {
    site24x7 = {
      source  = "site24x7/site24x7"
      // Update the latest version from https://registry.terraform.io/providers/site24x7/site24x7/latest 
      version = "0.0.1-beta.12"
    }
  }
}

A terraform provider for managing the following resources in Site24x7:

Usage example

Refer to the examples/ directory for a fully documented usage example.

This is a quick example of the provider configuration:

// Authentication API doc - https://www.site24x7.com/help/api/#authentication
provider "site24x7" {
  // The client ID will be looked up in the SITE24X7_OAUTH2_CLIENT_ID
  // environment variable if the attribute is empty or omitted.
  oauth2_client_id = "<SITE24X7_CLIENT_ID>"

  // The client secret will be looked up in the SITE24X7_OAUTH2_CLIENT_SECRET
  // environment variable if the attribute is empty or omitted.
  oauth2_client_secret = "<SITE24X7_CLIENT_SECRET>"

  // The refresh token will be looked up in the SITE24X7_OAUTH2_REFRESH_TOKEN
  // environment variable if the attribute is empty or omitted.
  oauth2_refresh_token = "<SITE24X7_REFRESH_TOKEN>"

  // Specify the data center from which you have obtained your
  // OAuth client credentials and refresh token. It can be (US/EU/IN/AU/CN).
  data_center = "US"
  
  // The minimum time to wait in seconds before retrying failed Site24x7 API requests.
  retry_min_wait = 1

  // The maximum time to wait in seconds before retrying failed Site24x7 API
  // requests. This is the upper limit for the wait duration with exponential
  // backoff.
  retry_max_wait = 30

  // Maximum number of Site24x7 API request retries to perform until giving up.
  max_retries = 4

}

// Website Monitor API doc: https://www.site24x7.com/help/api/#website
resource "site24x7_website_monitor" "website_monitor_us" {
  // (Required) Name of the monitor
  display_name = "Example Monitor"

  // (Required) Website address to monitor.
  website = "https://www.example.com"

  // (Optional) Check interval for monitoring. Default: 1. See
  // https://www.site24x7.com/help/api/#check-interval for all supported
  // values.
  check_frequency = 1
}

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.13+ is required). You'll also need to correctly setup a GOPATH, as well as adding $GOPATH/bin to your $PATH.

Building

Clone the repository and build the provider:

git clone git@github.com:Site24x7/terraform-provider-site24x7
cd terraform-provider-site24x7
./build/build_terraform_provider_site24x7.sh

This will build the terraform-provider-site24x7 binary and install it into the $HOME/.terraform.d/plugins/registry.zoho.io/zoho/site24x7/1.0.0/linux_amd64 directory.

Place the below content in ~/.terraformrc

provider_installation {
  filesystem_mirror {
    path = "$HOME/.terraform.d/plugins/"
    include = ["registry.zoho.io/*/*"]
  }
  direct {
    exclude = ["registry.zoho.io/*/*"]
  }
}

Please refer the following links for installing custom providers.

Go Version Support

We'll aim to support the latest supported release of Go, along with the previous release. This doesn't mean that building with an older version of Go will not work, but we don't intend to support a Go version in this project that is not supported by the larger Go community. Please see the Go releases page for more details.

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Even the tiniest contributions to the script or to the documentation are very welcome and greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b <branch name>)
  3. Commit your Changes (git commit -m '<commit message>')
  4. Push to the Branch (git push origin <branch name>)
  5. Open a Pull Request

License

Copyright (c) 2022 Zoho Corporation Private Limited

This project is licensed under the MIT License - see LICENSE file for details.

Acknowledgments

The Site24x7 Terraform Provider uses code from the following library: