Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pactflow/terraform-provider-pact

Terraform provider for Pact Broker (and Pactflow)
https://github.com/pactflow/terraform-provider-pact

pact pact-broker pactflow terraform

Last synced: 4 days ago
JSON representation

Terraform provider for Pact Broker (and Pactflow)

Awesome Lists containing this project

README

        

# Pact Broker - Terraform Provider

Terraform Provider for [Pact Broker](https://github.com/pact-foundation/pact_broker) and [Pactflow](https://pactflow.io).

[![Build Status](https://github.com/pactflow/terraform-provider-pact/actions/workflows/test.yml/badge.svg)](https://github.com/pactflow/terraform-provider-pact/actions/workflows/test.yml)
[![Coverage Status](https://coveralls.io/repos/github/pactflow/terraform/badge.svg?branch=master)](https://coveralls.io/github/pactflow/terraform?branch=master)
[![Go Report Card](https://goreportcard.com/badge/github.com/pactflow/terraform)](https://goreportcard.com/report/github.com/pactflow/terraform)
[![GoDoc](https://godoc.org/github.com/pactflow/terraform?status.svg)](https://godoc.org/github.com/pactflow/terraform)
[![slack](http://slack.pact.io/badge.svg)](http://slack.pact.io)

## Introduction



Example:

```hcl
terraform {
required_providers {
pact = {
source = "pactflow/pact"
version = "0.1.2" # check the version
}
}
}

variable "token" {
type = string
}

provider "pact" {
# For the OSS Broker
# host = "http://localhost"
# basic_auth_username = "pact_broker"
# basic_auth_password = "pact_broker"

# For a Pactflow Broker
host = "https://mybroker.pact.dius.com.au"
access_token = var.token
}

# Create a Pacticipant for our Product API
resource "pact_application" "product_api" {
name = "product_api"
repository_url = "github.com/foo/product_api"
}

# Create a Pacticipant for our Ecommerce Website
resource "pact_application" "ecommerce_web" {
name = "ecommerce_web"
repository_url = "github.com/foo/ecommerce_web"
}

# Create a secret
resource "pact_secret" "ci_token" {
name = "CIToken"
description = "Jenkins token for Pactflow"
value = "my super secret value"
}

# Create a webhook to trigger a build when a contract changes
# Uses the Jenkins token from above
resource "pact_webhook" "product_api_changed" {
description = "Trigger build when a contract changes between ecommerce_web and product_api"
webhook_provider = {
name = "product_api"
}
webhook_consumer = {
name = "ecommerce_web"
}
request {
url = "https://foo.com/some/endpoint"
method = "POST"
headers = {
"Content-Type" = "application/json",
"Authoriation" = "Bearer $${user.CIToken}"
}
body = <