Skip to content

Commit 3f3b9f0

Browse files
author
Bishwa Shrestha
authored
Merge pull request #5 from tidal-engineering/documentation
Terraform provider documentation
2 parents d20bdb4 + 5672743 commit 3f3b9f0

7 files changed

+203
-123
lines changed

README.md

+18-123
Original file line numberDiff line numberDiff line change
@@ -1,134 +1,29 @@
1-
# terraform-provider-spinnaker
1+
# Terraform Provider
22

3-
Manage [Spinnaker](https://spinnaker.io) applications and pipelines with Terraform.
3+
- Website: https://www.terraform.io
4+
- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby)
5+
- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool)
46

5-
## Demo
7+
<img src="https://cdn.rawgit.com/hashicorp/terraform-website/master/content/source/assets/images/logo-hashicorp.svg" width="300px">
68

7-
![demo](https://d2ddoduugvun08.cloudfront.net/items/1A0A1C2C1M243j0b2u16/Screen%20Recording%202018-11-23%20at%2012.18%20PM.gif)
9+
## Spinnaker
810

9-
## Example
11+
https://spinnaker.io/concepts/
1012

11-
```
12-
provider "spinnaker" {
13-
server = "http://spinnaker-gate.myorg.io"
14-
}
15-
16-
resource "spinnaker_application" "my_app" {
17-
application = "terraformtest"
18-
19-
}
20-
21-
resource "spinnaker_pipeline" "terraform_example" {
22-
application = "${spinnaker_application.my_app.application}"
23-
name = "Example Pipeline"
24-
pipeline = "${file("pipelines/example.json")}"
25-
}
26-
```
27-
28-
## Installation
29-
30-
#### Build from Source
31-
32-
_Requires Go to be installed on the system._
33-
34-
```
35-
$ env GO111MODULE=on go get github.com/armory-io/terraform-provider-spinnaker
36-
$ cd $GOPATH/src/github.com/armory-io/terraform-provider-spinnaker
37-
$ env GO111MODULE=on go build
38-
```
39-
40-
#### Installing 3rd Party Plugins
41-
42-
See [Terraform documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins) for installing 3rd party plugins.
43-
44-
## Provider
45-
46-
#### Example Usage
47-
48-
```
49-
provider "spinnaker" {
50-
server = "http://spinnaker-gate.myorg.io"
51-
config = "/path/to/config.yml"
52-
ignore_cert_errors = true
53-
default_headers = "Api-Key=abc123"
54-
}
55-
```
56-
57-
#### Argument Reference
58-
59-
- `server` - The Gate API Url
60-
- `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.
61-
- `ignore_cert_errors` - (Optional) - Set this to `true` to ignore certificate errors from Gate. Defaults to `false`.
62-
- `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 "".
63-
64-
## Resources
65-
66-
### `spinnaker_application`
67-
68-
#### Example Usage
13+
## Requirements
6914

70-
```
71-
resource "spinnaker_application" "my_app" {
72-
application = "terraformtest"
73-
74-
}
75-
```
76-
77-
#### Argument Reference
78-
79-
- `application` - Application name
80-
- `email` - Owner email
81-
82-
### `spinnaker_pipeline`
83-
84-
#### Example Usage
85-
86-
```
87-
resource "spinnaker_pipeline" "terraform_example" {
88-
application = "${spinnaker_application.my_app.application}"
89-
name = "Example Pipeline"
90-
pipeline = file("pipelines/example.json")
91-
}
92-
```
93-
94-
#### Argument Reference
95-
96-
- `application` - Application name
97-
- `name` - Pipeline name
98-
- `pipeline` - Pipeline JSON in string format, example `file(pipelines/example.json)`
15+
- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
16+
- [Go](https://golang.org/doc/install) 1.11 (to build the provider plugin)
9917

100-
### `spinnaker_pipeline_template`
101-
102-
#### Example Usage
103-
104-
```
105-
data "template_file" "dcd_template" {
106-
template = "${file("template.yml")}"
107-
}
108-
109-
resource "spinnaker_pipeline_template" "terraform_example" {
110-
template = "${data.template_file.dcd_template.rendered}"
111-
}
112-
```
113-
114-
#### Argument Reference
115-
116-
- `template` - A yaml formated [DCD Spec pipeline template](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#templates)
117-
118-
### `spinnaker_pipeline_template_config`
119-
120-
#### Example Usage
121-
122-
```
123-
data "template_file" "dcd_template_config" {
124-
template = "${file("config.yml")}"
125-
}
18+
## Building and Developing The Provider
12619

127-
resource "spinnaker_pipeline_template_config" "terraform_example" {
128-
pipeline_config = "${data.template_file.dcd_template_config.rendered}"
129-
}
20+
```sh
21+
$ git clone [email protected]:tidal-engineering/terraform-provider-spinnaker.git
22+
$ cd terraform-provider-spinnaker/
23+
$ go build
24+
$ go test./...
13025
```
13126

132-
#### Argument Reference
27+
## Using the provider
13328

134-
- `pipeline_config` - A yaml formated [DCD Spec pipeline configuration](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#configurations)
29+
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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
page_title: "spinnaker_pipeline"
3+
---
4+
5+
# spinnaker_pipeline Data Source
6+
7+
Read spinnaker pipeline resource
8+
9+
## Example Usage
10+
11+
```
12+
provider "spinnaker" {
13+
server = "http://spinnaker-gate.myorg.io"
14+
}
15+
16+
data "spinnaker_application" "terraform_example" {
17+
application = "terraformexample"
18+
19+
}
20+
```
21+
22+
## Argument Reference
23+
24+
- `application` - (Required) Spinnaker application name.
25+
- `name` - (Required) Pipeline name.
26+
27+
## Attribute Reference
28+
29+
In addition to the above, the following attributes are exported:
30+
31+
- `pipeline` - (Required) Pipeline json
32+
- `pipeline_id` - Pipeline ID

docs/index.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
page_title: "Provider: Spinnaker"
3+
---
4+
5+
# Spinnaker Provider
6+
7+
Manage [Spinnaker](https://spinnaker.io) applications and pipelines with Terraform.
8+
9+
## Example Usage
10+
11+
```hcl
12+
provider "spinnaker" {
13+
server = "http://spinnaker-gate.myorg.io"
14+
}
15+
16+
resource "spinnaker_application" "terraform_example" {
17+
application = "terraformexample"
18+
19+
}
20+
21+
resource "spinnaker_pipeline" "terraform_example" {
22+
application = spinnaker_application.terraform_example.application
23+
name = "Example Pipeline"
24+
pipeline = file("pipelines/example.json")
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
The following arguments are supported. Defaults to Env variables if not specified
31+
32+
- `server`: (Required) URL for Gate (Default: Env `GATE_URL`)
33+
- `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`)
34+
- `ignore_cert_errors`: (Optional) Ignore certificate errors from Gate (Default: `false`)
35+
- `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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
page_title: "spinnaker_application"
3+
---
4+
5+
# spinnaker_application Resource
6+
7+
Manage spinnaker applications
8+
9+
## Example Usage
10+
11+
```hcl
12+
resource "spinnaker_application" "terraformtest" {
13+
application = "terraformtest"
14+
15+
}
16+
```
17+
18+
## Argument Reference
19+
20+
- `application` - (Required) Spinnaker application name.
21+
- `email` - (Required) Application owner email.
22+
- `description` - (Optional) Description. (Default: `""`)
23+
- `platform_health_only` - (Optional) Consider only cloud provider health when executing tasks. (Default: `false`)
24+
- `platform_health_only_show_override` - (Optional) Show health override option for each operation. (Default: `false`)
25+
26+
## Attribute Reference

docs/resources/spinnaker_pipeline.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
page_title: "spinnaker_pipeline"
3+
---
4+
5+
# spinnaker_pipeline Resource
6+
7+
Manage spinnaker pipeline
8+
9+
## Example Usage
10+
11+
```
12+
provider "spinnaker" {
13+
server = "http://spinnaker-gate.myorg.io"
14+
}
15+
16+
resource "spinnaker_application" "terraform_example" {
17+
application = "terraformexample"
18+
19+
}
20+
21+
resource "spinnaker_pipeline" "terraform_example" {
22+
application = spinnaker_application.terraform_example.application
23+
name = "Example Pipeline"
24+
pipeline = file("pipelines/example.json")
25+
}
26+
```
27+
28+
## Argument Reference
29+
30+
- `application` - (Required) Spinnaker application name.
31+
- `name` - (Required) Pipeline name.
32+
- `pipeline` - (Required) Pipeline json
33+
34+
## Attribute Reference
35+
36+
In addition to the above, the following attributes are exported:
37+
38+
- `pipeline_id` - Pipeline ID
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
page_title: "spinnaker_pipeline_template"
3+
---
4+
5+
# spinnaker_pipeline_template Resource
6+
7+
Manage spinnaker pipeline templates
8+
9+
## Example Usage
10+
11+
```hcl
12+
data "template_file" "dcd_template" {
13+
template = file("template.yml")
14+
}
15+
16+
resource "spinnaker_pipeline_template" "terraform_example" {
17+
template = data.template_file.dcd_template.rendered
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
- `template` - A yaml formatted [DCD Spec pipeline template](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#templates)
24+
25+
## Attribute Reference
26+
27+
In addition to the above, the following attributes are exported:
28+
29+
- `url` - URL of the pipeline template
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
page_title: "spinnaker_pipeline_template"
3+
---
4+
5+
# spinnaker_pipeline_template_config Resource
6+
7+
Manage spinnaker pipeline templates
8+
9+
## Example Usage
10+
11+
```hcl
12+
data "template_file" "dcd_template_config" {
13+
template = file("config.yml")
14+
}
15+
16+
resource "spinnaker_pipeline_template_config" "terraform_example" {
17+
pipeline_config = data.template_file.dcd_template_config.rendered
18+
}
19+
```
20+
21+
## Argument Reference
22+
23+
- `pipeline_config` - A yaml formated [DCD Spec pipeline configuration](https://github.com/spinnaker/dcd-spec/blob/master/PIPELINE_TEMPLATES.md#configurations)
24+
25+
## Attribute Reference

0 commit comments

Comments
 (0)