From 56727432cd220f52f5a514f1cd5617d0252637de Mon Sep 17 00:00:00 2001 From: Bishwa Shrestha Date: Thu, 24 Sep 2020 12:43:35 +0200 Subject: [PATCH] Terraform provider documentation --- README.md | 141 +++--------------- docs/data-sources/spinnaker_pipeline.md | 32 ++++ docs/index.md | 35 +++++ docs/resources/spinnaker_application.md | 26 ++++ docs/resources/spinnaker_pipeline.md | 38 +++++ docs/resources/spinnaker_pipeline_template.md | 29 ++++ .../spinnaker_pipeline_template_config.md | 25 ++++ 7 files changed, 203 insertions(+), 123 deletions(-) create mode 100644 docs/data-sources/spinnaker_pipeline.md create mode 100644 docs/index.md create mode 100644 docs/resources/spinnaker_application.md create mode 100644 docs/resources/spinnaker_pipeline.md create mode 100644 docs/resources/spinnaker_pipeline_template.md create mode 100644 docs/resources/spinnaker_pipeline_template_config.md diff --git a/README.md b/README.md index 44ef368..b243e9f 100644 --- a/README.md +++ b/README.md @@ -1,134 +1,29 @@ -# terraform-provider-spinnaker +# Terraform Provider -Manage [Spinnaker](https://spinnaker.io) applications and pipelines with Terraform. +- Website: https://www.terraform.io +- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) +- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool) -## Demo + -![demo](https://d2ddoduugvun08.cloudfront.net/items/1A0A1C2C1M243j0b2u16/Screen%20Recording%202018-11-23%20at%2012.18%20PM.gif) +## Spinnaker -## Example +https://spinnaker.io/concepts/ -``` -provider "spinnaker" { - server = "http://spinnaker-gate.myorg.io" -} - -resource "spinnaker_application" "my_app" { - application = "terraformtest" - email = "ethan@armory.io" -} - -resource "spinnaker_pipeline" "terraform_example" { - application = "${spinnaker_application.my_app.application}" - name = "Example Pipeline" - pipeline = "${file("pipelines/example.json")}" -} -``` - -## Installation - -#### Build from Source - -_Requires Go to be installed on the system._ - -``` -$ env GO111MODULE=on go get github.com/armory-io/terraform-provider-spinnaker -$ cd $GOPATH/src/github.com/armory-io/terraform-provider-spinnaker -$ env GO111MODULE=on go build -``` - -#### Installing 3rd Party Plugins - -See [Terraform documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) for installing 3rd party plugins. - -## Provider - -#### Example Usage - -``` -provider "spinnaker" { - server = "http://spinnaker-gate.myorg.io" - config = "/path/to/config.yml" - ignore_cert_errors = true - default_headers = "Api-Key=abc123" -} -``` - -#### Argument Reference - -- `server` - The Gate API Url -- `config` - (Optional) - Path to Gate config file. See the [Spin CLI](https://github.com/spinnaker/spin/blob/master/config/example.yaml) for an example config. -- `ignore_cert_errors` - (Optional) - Set this to `true` to ignore certificate errors from Gate. Defaults to `false`. -- `default_headers` - (Optional) - Pass through a comma separated set of key value pairs to set default headers for the gate client when sending requests to your gate endpoint e.g. "header1=value1,header2=value2". Defaults to "". - -## Resources - -### `spinnaker_application` - -#### Example Usage +## Requirements -``` -resource "spinnaker_application" "my_app" { - application = "terraformtest" - email = "ethan@armory.io" -} -``` - -#### Argument Reference - -- `application` - Application name -- `email` - Owner email - -### `spinnaker_pipeline` - -#### Example Usage - -``` -resource "spinnaker_pipeline" "terraform_example" { - application = "${spinnaker_application.my_app.application}" - name = "Example Pipeline" - pipeline = file("pipelines/example.json") -} -``` - -#### Argument Reference - -- `application` - Application name -- `name` - Pipeline name -- `pipeline` - Pipeline JSON in string format, example `file(pipelines/example.json)` +- [Terraform](https://www.terraform.io/downloads.html) 0.10.x +- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin) -### `spinnaker_pipeline_template` - -#### Example Usage - -``` -data "template_file" "dcd_template" { - template = "${file("template.yml")}" -} - -resource "spinnaker_pipeline_template" "terraform_example" { - template = "${data.template_file.dcd_template.rendered}" -} -``` - -#### Argument Reference - -- `template` - A yaml formated [DCD Spec pipeline template](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#templates) - -### `spinnaker_pipeline_template_config` - -#### Example Usage - -``` -data "template_file" "dcd_template_config" { - template = "${file("config.yml")}" -} +## Building and Developing The Provider -resource "spinnaker_pipeline_template_config" "terraform_example" { - pipeline_config = "${data.template_file.dcd_template_config.rendered}" -} +```sh +$ git clone git@github.com:tidal-engineering/terraform-provider-spinnaker.git +$ cd terraform-provider-spinnaker/ +$ go build +$ go test./... ``` -#### Argument Reference +## Using the provider -- `pipeline_config` - A yaml formated [DCD Spec pipeline configuration](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#configurations) +If you're building the provider, follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-a-plugin) After placing it into your plugins directory, run `terraform init` to initialize it. diff --git a/docs/data-sources/spinnaker_pipeline.md b/docs/data-sources/spinnaker_pipeline.md new file mode 100644 index 0000000..64ead7d --- /dev/null +++ b/docs/data-sources/spinnaker_pipeline.md @@ -0,0 +1,32 @@ +--- +page_title: "spinnaker_pipeline" +--- + +# spinnaker_pipeline Data Source + +Read spinnaker pipeline resource + +## Example Usage + +``` +provider "spinnaker" { + server = "http://spinnaker-gate.myorg.io" +} + +data "spinnaker_application" "terraform_example" { + application = "terraformexample" + email = "user@example.com" +} +``` + +## Argument Reference + +- `application` - (Required) Spinnaker application name. +- `name` - (Required) Pipeline name. + +## Attribute Reference + +In addition to the above, the following attributes are exported: + +- `pipeline` - (Required) Pipeline json +- `pipeline_id` - Pipeline ID diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..150addd --- /dev/null +++ b/docs/index.md @@ -0,0 +1,35 @@ +--- +page_title: "Provider: Spinnaker" +--- + +# Spinnaker Provider + +Manage [Spinnaker](https://spinnaker.io) applications and pipelines with Terraform. + +## Example Usage + +```hcl +provider "spinnaker" { + server = "http://spinnaker-gate.myorg.io" +} + +resource "spinnaker_application" "terraform_example" { + application = "terraformexample" + email = "user@example.com" +} + +resource "spinnaker_pipeline" "terraform_example" { + application = spinnaker_application.terraform_example.application + name = "Example Pipeline" + pipeline = file("pipelines/example.json") +} +``` + +## Argument Reference + +The following arguments are supported. Defaults to Env variables if not specified + +- `server`: (Required) URL for Gate (Default: Env `GATE_URL`) +- `config`: (Optional) Path to Gate config file. See the [Spin CLI](https://github.com/spinnaker/spin/blob/master/config/example.yaml) for an example config. (Default: Env `SPINNAKER_CONFIG_PATH`) +- `ignore_cert_errors`: (Optional) Ignore certificate errors from Gate (Default: `false`) +- `default_headers`: (Optional) A comma separated set of key value pairs to set default headers for the gate client when sending requests to your gate endpoint e.g. "header1=value1,header2=value2". (Default: `""`) diff --git a/docs/resources/spinnaker_application.md b/docs/resources/spinnaker_application.md new file mode 100644 index 0000000..159c4f2 --- /dev/null +++ b/docs/resources/spinnaker_application.md @@ -0,0 +1,26 @@ +--- +page_title: "spinnaker_application" +--- + +# spinnaker_application Resource + +Manage spinnaker applications + +## Example Usage + +```hcl +resource "spinnaker_application" "terraformtest" { + application = "terraformtest" + email = "user@example.com" +} +``` + +## Argument Reference + +- `application` - (Required) Spinnaker application name. +- `email` - (Required) Application owner email. +- `description` - (Optional) Description. (Default: `""`) +- `platform_health_only` - (Optional) Consider only cloud provider health when executing tasks. (Default: `false`) +- `platform_health_only_show_override` - (Optional) Show health override option for each operation. (Default: `false`) + +## Attribute Reference diff --git a/docs/resources/spinnaker_pipeline.md b/docs/resources/spinnaker_pipeline.md new file mode 100644 index 0000000..316625d --- /dev/null +++ b/docs/resources/spinnaker_pipeline.md @@ -0,0 +1,38 @@ +--- +page_title: "spinnaker_pipeline" +--- + +# spinnaker_pipeline Resource + +Manage spinnaker pipeline + +## Example Usage + +``` +provider "spinnaker" { + server = "http://spinnaker-gate.myorg.io" +} + +resource "spinnaker_application" "terraform_example" { + application = "terraformexample" + email = "user@example.com" +} + +resource "spinnaker_pipeline" "terraform_example" { + application = spinnaker_application.terraform_example.application + name = "Example Pipeline" + pipeline = file("pipelines/example.json") +} +``` + +## Argument Reference + +- `application` - (Required) Spinnaker application name. +- `name` - (Required) Pipeline name. +- `pipeline` - (Required) Pipeline json + +## Attribute Reference + +In addition to the above, the following attributes are exported: + +- `pipeline_id` - Pipeline ID diff --git a/docs/resources/spinnaker_pipeline_template.md b/docs/resources/spinnaker_pipeline_template.md new file mode 100644 index 0000000..c12fce2 --- /dev/null +++ b/docs/resources/spinnaker_pipeline_template.md @@ -0,0 +1,29 @@ +--- +page_title: "spinnaker_pipeline_template" +--- + +# spinnaker_pipeline_template Resource + +Manage spinnaker pipeline templates + +## Example Usage + +```hcl +data "template_file" "dcd_template" { + template = file("template.yml") +} + +resource "spinnaker_pipeline_template" "terraform_example" { + template = data.template_file.dcd_template.rendered +} +``` + +## Argument Reference + +- `template` - A yaml formatted [DCD Spec pipeline template](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#templates) + +## Attribute Reference + +In addition to the above, the following attributes are exported: + +- `url` - URL of the pipeline template diff --git a/docs/resources/spinnaker_pipeline_template_config.md b/docs/resources/spinnaker_pipeline_template_config.md new file mode 100644 index 0000000..bc1d851 --- /dev/null +++ b/docs/resources/spinnaker_pipeline_template_config.md @@ -0,0 +1,25 @@ +--- +page_title: "spinnaker_pipeline_template" +--- + +# spinnaker_pipeline_template_config Resource + +Manage spinnaker pipeline templates + +## Example Usage + +```hcl +data "template_file" "dcd_template_config" { + template = file("config.yml") +} + +resource "spinnaker_pipeline_template_config" "terraform_example" { + pipeline_config = data.template_file.dcd_template_config.rendered +} +``` + +## Argument Reference + +- `pipeline_config` - A yaml formated [DCD Spec pipeline configuration](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#configurations) + +## Attribute Reference