Skip to content

Commit

Permalink
feat: initial refactoring and work on new release
Browse files Browse the repository at this point in the history
  • Loading branch information
danitso-dp committed Feb 11, 2021
1 parent 80e9e9d commit 6daf9a1
Show file tree
Hide file tree
Showing 38 changed files with 1,449 additions and 568 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Create release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Tag
runs-on: ubuntu-20.04
steps:
-
name: Checkout the code
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Install and configure Go
uses: actions/setup-go@v2
with:
go-version: 1.15
-
name: Install and configure GoReleaser
env:
GORELEASER_VERSION: '0.155.1'
run: |
curl -sL -o goreleaser_amd64.deb "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb"
sudo dpkg -i goreleaser_amd64.deb
rm -f goreleaser_amd64.deb
-
name: Import the GPG signing key
env:
GPG_KEY: ${{ secrets.GPG_KEY }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
mkdir -p ~/.gnupg
chmod 0700 ~/.gnupg
cat << EOF > ~/.gnupg/gpg.conf
use-agent
pinentry-mode loopback
EOF
echo "$GPG_KEY" | base64 -d | gpg --batch --allow-secret-key-import --import
gpg --keyid-format LONG --list-secret-keys
cat << EOF > ~/.gnupg/gpg-agent.conf
default-cache-ttl 7200
max-cache-ttl 31536000
allow-loopback-pinentry
allow-preset-passphrase
EOF
echo RELOADAGENT | gpg-connect-agent
printf '%s' "$GPG_PASSPHRASE" > /tmp/.gpg_passphrase
-
name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ secrets.GPG_FINGERPRINT }}
run: |
goreleaser release --parallelism 2 --rm-dist --timeout 1h
34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test changes
on:
pull_request:
branches:
- main
- master
- 'v*'
jobs:
test:
name: Pull Request
runs-on: ubuntu-20.04
steps:
-
name: Checkout the code
uses: actions/checkout@v2
with:
fetch-depth: 0
-
name: Install and configure Go
uses: actions/setup-go@v2
with:
go-version: 1.15
-
name: Install and configure GoReleaser
env:
GORELEASER_VERSION: '0.155.1'
run: |
curl -sL -o goreleaser_amd64.deb "https://github.com/goreleaser/goreleaser/releases/download/v${GORELEASER_VERSION}/goreleaser_amd64.deb"
sudo dpkg -i goreleaser_amd64.deb
rm -f goreleaser_amd64.deb
-
name: Create snapshot
run: |
goreleaser build --parallelism 2 --rm-dist --snapshot --timeout 1h
48 changes: 48 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
mod_timestamp: '{{ .CommitTimestamp }}'
flags:
- -trimpath
ldflags:
- '-s -w -X main.version={{.Version}} -X main.commit={{.Commit}}'
goos:
- freebsd
- windows
- linux
- darwin
goarch:
- amd64
- '386'
- arm
- arm64
ignore:
- goos: darwin
goarch: '386'
binary: '{{ .ProjectName }}_v{{ .Version }}'
archives:
- format: zip
name_template: '{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}'
checksum:
name_template: '{{ .ProjectName }}_{{ .Version }}_SHA256SUMS'
algorithm: sha256
signs:
- artifacts: checksum
args:
- "--batch"
- "--local-user"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--passphrase-fd"
- "0"
- "--detach-sign"
- "${artifact}"
stdin_file: /tmp/.gpg_passphrase
release:
draft: false
changelog:
skip: true
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
## v0.3.0

ENHANCEMENTS:

* provider: Upgrade to Go v1.15
* provider: Upgrade dependencies

OTHER:

* provider/docs: Add HTML documentation powered by GitHub Pages and Terraform Registry

## 0.2.2

ENHANCEMENTS:
Expand Down
180 changes: 24 additions & 156 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,174 +1,42 @@
[![Build Status](https://api.travis-ci.com/danitso/terraform-provider-ironio.svg?branch=master)](https://travis-ci.com/danitso/terraform-provider-ironio)
[![Go Report Card](https://goreportcard.com/badge/github.com/danitso/terraform-provider-ironio)](https://goreportcard.com/report/github.com/danitso/terraform-provider-ironio)
[![GoDoc](https://godoc.org/github.com/danitso/terraform-provider-ironio?status.svg)](http://godoc.org/github.com/danitso/terraform-provider-ironio)

# Terraform Provider for Iron.io
A Terraform Provider to manage IronAuth, IronCache, IronMQ and IronWorker resources from [Iron.io](https://iron.io/).

*Support is currently limited to IronAuth and IronMQ.*

## Requirements
- [Terraform](https://www.terraform.io/downloads.html) 0.13+
- [Go](https://golang.org/doc/install) 1.15+ (to build the provider plugin)
- [GoReleaser](https://goreleaser.com/install/) 0.155+ (to build the provider plugin)

- [Terraform](https://www.terraform.io/downloads.html) 0.11+
- [Go](https://golang.org/doc/install) 1.13 (to build the provider plugin)
## Table of Contents
- [Building the provider](#building-the-provider)
- [Using the provider](#using-the-provider)
- [Testing the provider](#testing-the-provider)

## Building the Provider
Clone repository to: `$GOPATH/src/github.com/danitso/terraform-provider-ironio`
## Building the provider
- Clone the repository to `$GOPATH/src/github.com/danitso/terraform-provider-ironio`:

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

Enter the provider directory, initialize and build the provider

```sh
$ cd $GOPATH/src/github.com/danitso/terraform-provider-ironio
$ make init
$ make build
```

## Using the Provider
If you're building the provider, follow the instructions to [install it as a plugin.](https://www.terraform.io/docs/plugins/basics.html#installing-plugins) After placing it into your plugins directory, run `terraform init` to initialize it.

### Configuration

#### Arguments

* `auth` - (Optional) This is the IronAuth configuration block
* `host` - (Optional) This is the address of the IronAuth service. Defaults to `auth.iron.io`.
* `port` - (Optional) This is the port number for the IronAuth service. Defaults to `443`.
* `protocol` - (Optional) This is the protocol to use for IronAuth requests. Defaults to `https`.
* `token` - (Optional) This is the IronAuth token (OAuth). This is only optional as long as `load_config_file` is set to `true` and when the `iron.json` configuration file contains a valid token.
* `cache` - (Optional) This is the IronCache configuration block
* `host` - (Optional) This is the address of the IronCache service. Defaults to `cache-aws-us-east-1.iron.io`.
* `port` - (Optional) This is the port number for the IronCache service. Defaults to `443`.
* `protocol` - (Optional) This is the protocol to use for IronCache requests. Defaults to `https`.
* `load_config_file` - (Optional) This determines whether to load configuration values from the `iron.json` configuration file. Defaults to `false`.
* `mq` - (Optional) This is the IronMQ configuration block
* `host` - (Optional) This is the address of the IronMQ service. Defaults to `mq-aws-us-east-1-1.iron.io`.
* `port` - (Optional) This is the port number for the IronMQ service. Defaults to `443`.
* `protocol` - (Optional) This is the protocol to use for IronMQ requests. Defaults to `https`.
* `worker` - (Optional) This is the IronWorker configuration block
* `host` - (Optional) This is the address of the IronWorker service. Defaults to `worker-aws-us-east-1.iron.io`.
* `port` - (Optional) This is the port number for the IronWorker service. Defaults to `443`.
* `protocol` - (Optional) This is the protocol to use for IronWorker requests. Defaults to `https`.

### Data Sources

#### Pull Queue (ironio_pull_queue)

##### Arguments

* `name` - (Required) This is the name of the queue.
* `project_id` - (Required) This is the id of the project to add the queue to.

##### Attributes

* `message_count` - This is the number of messages currently in the queue.
* `message_count_total` - This is the number of messages which have been processed by the queue.

#### Push Queue (ironio_push_queue)

##### Arguments

* `name` - (Required) This is the name of the queue.
* `project_id` - (Required) This is the id of the project to add the queue to.

##### Attributes

* `error_queue` - This is the name of an error queue.
* `message_count` - This is the number of messages currently in the queue.
* `message_count_total` - This is the number of messages which have been processed by the queue.
* `multicast` - Whether to create a multicast queue instead of a unicast queue.
* `retries` - This is the number of times to try to send a message to a subscriber before moving the message to the error queue.
* `retries_delay` - This is the number of seconds to wait before retrying a failed message.
* `subscriber` - This is the list of subscribers.
* `headers` - This is the headers to include when sending a message to the subscriber.
* `name` - This is the name of the subscriber.
* `url` - This is the URL for the subscriber.

#### Projects (ironio_projects)

##### Arguments

* `filter` - (Optional) This is the filter block.
* `name` - (Optional) This is the name filter. You can either do an exact match, a prefix match (`prefix*`), a suffix match (`*suffix`) or a wildcard match (`*wildcard*`).
```sh
$ mkdir -p "${GOPATH}/src/github.com/danitso"
$ cd "${GOPATH}/src/github.com/danitso"
$ git clone [email protected]:danitso/terraform-provider-ironio
```

##### Attributes
- Enter the provider directory and build it:

* `ids` - This is the list of project ids.
* `names` - This is the list of project names.

#### Queues (ironio_queues)

##### Arguments

* `filter` - (Optional) This is the filter block.
* `name` - (Optional) This is the name filter. You can either do an exact match, a prefix match (`prefix*`), a suffix match (`*suffix`) or a wildcard match (`*wildcard*`).
* `pull` - (Optional) Whether to include pull queues in the result.
* `push` - (Optional) Whether to include push queues in the result.
* `project_id` - (Required) This is the id of the project to retrieve the queues from.

##### Attributes

* `names` - This is the list of queue names.
* `types` - This is the list of queue types (`pull` or `push`).

### Resources

#### Project (ironio_project)

##### Arguments

* `name` - (Required) This is the name of the project.

#### Pull Queue (ironio_pull_queue)

##### Arguments

* `name` - (Required) This is the name of the queue.
* `project_id` - (Required) This is the id of the project to add the queue to.

##### Attributes

* `message_count` - This is the number of messages currently in the queue.
* `message_count_total` - This is the number of messages which have been processed by the queue.

#### Push Queue (ironio_push_queue)

##### Arguments

* `error_queue` - (Optional) This is the name of an error queue.
* `multicast` - (Optional) Whether to create a multicast queue instead of a unicast queue. Defaults to `true`.
* `name` - (Required) This is the name of the queue.
* `project_id` - (Required) This is the id of the project to add the queue to.
* `retries` - (Optional) This is the number of times to try to send a message to a subscriber before moving the message to the error queue. Defaults to `3`.
* `retries_delay` - (Optional) This is the number of seconds to wait before retrying a failed message. Defaults to `60`.
* `subscriber` - (Required) This the subscriber block (at least one must be specified).
* `headers` - (Optional) This is the headers to include when sending a message to the subscriber. Defaults to `{}`.
* `name` - (Optional) This is the name of the subscriber. Defaults to an empty string.
* `url` - (Required) This is the URL for the subscriber.

##### Attributes

* `message_count` - This is the number of messages currently in the queue.
* `message_count_total` - This is the number of messages which have been processed by the queue.

## Developing the Provider
If you wish to work on the provider, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.13+ is *required*).
You'll also need to correctly setup a [GOPATH](http://golang.org/doc/code.html#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.

```sh
$ make build
...
$ $GOPATH/bin/terraform-provider-ironio
...
```
```sh
$ cd "${GOPATH}/src/github.com/danitso/terraform-provider-ironio"
$ make build
```

If you wish to contribute to the provider, please see [CONTRIBUTING.md](CONTRIBUTING.md).
## Using the provider
You can find the latest release and its documentation in the [Terraform Registry](https://registry.terraform.io/providers/danitso/ironio/latest).

## Testing the Provider
## Testing the provider
In order to test the provider, you can simply run `make test`.

```sh
Expand Down
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
_site
.sass-cache
.jekyll-metadata
26 changes: 26 additions & 0 deletions docs/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
layout: default
title: 404
nav_exclude: true
---

<style type="text/css" media="screen">
.container {
margin: 10px auto;
max-width: 600px;
text-align: center;
}
h1 {
margin: 30px 0;
font-size: 4em;
line-height: 1;
letter-spacing: -1px;
}
</style>

<div class="container">
<h1>404</h1>

<p><strong>Page not found :(</strong></p>
<p>The requested page could not be found.</p>
</div>
Loading

0 comments on commit 6daf9a1

Please sign in to comment.