terraform-provider-scalingo

command module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

README

Terraform Provider

Documentation

Maintainers

This provider plugin is maintained by the Scalingo team.

Requirements

  • Terraform 0.10.x
  • Go 1.9 (to build the provider plugin)

Usage

Configuring with variables
variable "scalingo_api_token" {}

provider "scalingo" {
  api_token = "${var.scalingo_api_token}"
  region = "osc-fr1"
}
export TF_VAR_scalingo_api_token=tk-us-1234567890
terraform plan
Configuration with environment variables
provider "scalingo" {}
export SCALINGO_REGION=osc-fr1
export SCALINGO_API_TOKEN=tk-us-1234567890

terraform plan
Use terraform import

Some resources are using a specific syntax using a : to provide multiple information.

The terraform import command is formatted like the following:

terraform import <ADDR> <ID>

For example, to import alerts the ID is composed like: <application ID>:<alert ID>

terraform import scalingo_alert.cpu_alert my-app:al-18f30d13-3c19-422d-a0d6-6cdb254baeb7

Building The Provider

Clone repository to: $GOPATH/src/github.com/Scalingo/terraform-provider-scalingo

$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/Scalingo
$ git clone git@github.com:Scalingo/terraform-provider-scalingo

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/Scalingo/terraform-provider-scalingo
$ make build

Using the provider

See documentation

Developing the Provider

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

To compile the provider, run make build. This will build the provider and put the provider binary in the $GOPATH/bin directory.

$ make bin
...
$ $GOPATH/bin/terraform-provider-scalingo
...

In order to test the provider, you can simply run make test.

$ make test

In order to run the full suite of Acceptance tests, run make testacc.

Note: Acceptance tests create real resources, and often cost money to run.

$ make testacc
Testing the plugin against the staging environment

Please read the README in the scalingo-terraform to get more information about that.

Testing the plugin against the development environment

First you will need to create a terraform configuration file defining the plugin installation path

# local_dev.tfrc

provider_installation {
  dev_overrides {
    "scalingo/scalingo" = "<your-gopath>/bin/"
  }
}

Then you can use the development plugin by precising the configuration path in the TF_CLI_CONFIG_FILE env variable

TF_CLI_CONFIG_FILE=./local_dev.tfrc terraform plan

Alternatively you can add the provider configuration to the $HOME/.terraformrc file

Generate Documentation

Documentation of the provider is based on official Terraform documentation plugin: https://github.com/hashicorp/terraform-plugin-docs

go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest
tfplugindocs

By running the process, it will scan all resources metadata plus the examples directory to generate a complete documentation structure in the docs/ directory.

Release a New Version

Instructions on this Notion page.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package scalingo is the main package of the Terraform Provider for Scalingo.
Package scalingo is the main package of the Terraform Provider for Scalingo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL