Skip to content

Commit

Permalink
Merge pull request #5 from tidal-engineering/documentation
Browse files Browse the repository at this point in the history
Terraform provider documentation
  • Loading branch information
Bishwa Shrestha authored Sep 24, 2020
2 parents d20bdb4 + 5672743 commit 3f3b9f0
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 123 deletions.
141 changes: 18 additions & 123 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="300px">

![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.
32 changes: 32 additions & 0 deletions docs/data-sources/spinnaker_pipeline.md
Original file line number Diff line number Diff line change
@@ -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
35 changes: 35 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -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: `""`)
26 changes: 26 additions & 0 deletions docs/resources/spinnaker_application.md
Original file line number Diff line number Diff line change
@@ -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
38 changes: 38 additions & 0 deletions docs/resources/spinnaker_pipeline.md
Original file line number Diff line number Diff line change
@@ -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
29 changes: 29 additions & 0 deletions docs/resources/spinnaker_pipeline_template.md
Original file line number Diff line number Diff line change
@@ -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
25 changes: 25 additions & 0 deletions docs/resources/spinnaker_pipeline_template_config.md
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 3f3b9f0

Please sign in to comment.