Skip to content

Commit

Permalink
Update README and instructions for installing
Browse files Browse the repository at this point in the history
  • Loading branch information
cvbarros committed Dec 10, 2019
1 parent 3792d58 commit bf741fc
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ BUILDER_IMAGE=cvbarros/terraform-provider-teamcity-builder
default: test

build:
go build -o ./bin/terraform-provider-teamcity_${VERSION}
GO111MODULE=on go build -o ./bin/terraform-provider-teamcity_${VERSION}

install: build
cp ./bin/terraform-provider-teamcity_${VERSION} ~/.terraform.d/plugins/
Expand Down
72 changes: 58 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,77 @@ Motivation:

[Building Builds: TeamCity Pipelines as Code using Terraform](https://cvbarros.io/2018/11/building-builds---teamcity-pipelines-as-code-using-terraform/)

Requirements
Installation
------------

## Binaries (Recommended)
The easiest way to install this provider is to use one of the binary distributions available as
[Releases](https://github.com/cvbarros/terraform-provider-teamcity/releases).
It contains pre-compiled bundles for Linux, MacOS and Windows.

Download and unpack the version for your OS/arch.
In the example below, we use MacOS (darwin_amd64) and version `v0.5.1`:

```bash
VERSION=v0.5.1
wget https://github.com/cvbarros/terraform-provider-teamcity/releases/download/$VERSION/terraform-provider-teamcity_darwin_amd64_$VERSION.zip
tar -xvf terraform-provider-teamcity_darwin_amd64_$VERSION.zip
```

Then, copy the output file to your `~/.terraform.d/plugins` directory.
For Windows, use the directory `%APPDATA%\terraform.d\plugins`

> **Note**: If you never installed any terraform providers before, you'll have to create that directory.
```bash
cp terraform-provider-teamcity_$VERSION ~/.terraform.d/plugins/
```

## Build from Source

### Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.11.x (advised 0.12+)
- [Go](https://golang.org/doc/install) 1.12 (to build the provider plugin)

Building The Provider
---------------------

Clone repository to: `$GOPATH/src/github.com/cvbarros/terraform-provider-teamcity`
Clone the repository to the directory of your choice, then from the root of repository, run the target below.
It is advisable to checkout a tag corresponding to a version first, instead of `master`.

```sh
$ mkdir -p $GOPATH/src/github.com/cvbarros/terraform-provider-teamcity; cd $GOPATH/src/github.com/cvbarros
$ git clone [email protected]:cvbarros/terraform-provider-teamcity
```

Enter the provider directory and build the provider
If the [plugins directory](https://www.terraform.io/docs/plugins/basics.html#installing-plugins) doesn't exist, you have to create it first.

```sh
$ cd $GOPATH/src/github.com/cvbarros/terraform-provider-teamcity
$ go build -o $GOPATH/bin/terraform-provider-teamcity
```bash
$ VERSION=v0.5.1 make install
```
This will build a binary for your platform and place it on the .

Using the provider
----------------------
To use it in your Terraform configurations after installing, declare a provider block:

```hcl-terraform
provider "teamcity" {
address = "https://teamcity.yourserver.com:8112"
username = "username"
password = "password"
}
```

### Provider configuration via Environment Variables
All provider attributes above can be configured via environment variables. This is specially useful for credentials.

| Parameter | Environment Variable |
|-----------|----------------------|
| address | TEAMCITY_ADDR |
| username | TEAMCITY_USER |
| password | TEAMCITY_PASS |

> By using these variables, you may omit the attributes on the provider configuration, as they will be read from environment.
### Documentation

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.
Documentation on available resources is under `website` directory in markdown format.
If you would like to contribute to keep documentation error-free and up to date, please see [CONTRIBUTING](CONTRIBUTING.MD#).
This format is compatible with other providers on [Terraform Docs](https://www.terraform.io/docs/providers/index.html).

Example Configurations
----------------------
Expand Down

0 comments on commit bf741fc

Please sign in to comment.