Code Monkey home page Code Monkey logo

terraform-provider-runscope's Introduction

Build Status

Terraform Runscope Provider

This repository contains a plugin form of the Runscope provider that was proposed and submitted in Terraform PR #14221.

The Runscope provider is used to create and manage Runscope tests using the official Runscope API

Installing

See the Plugin Basics page of the Terraform docs to see how to plunk this into your config. Check the releases page of this repo to get releases for Linux, OS X, and Windows.

Releasing

Releases are automatically setup to go out from the master branch after a build is made on master with a tag.

To perform a release simply create a tag: git tag -a v0.0.2 -m "Release message"

Then push your tag: git push origin v0.0.2

That's it, the build will now run and create a new release on github :

Usage

The following section details the use of the provider and its resources.

These docs are derived from the middleman templates that were created for the PR itself, and can be found in their original form here.

Example Usage

The below example is an end-to-end demonstration of the setup of a basic runscope test:

Creating a test with a step

resource "runscope_step" "main_page" {
  bucket_id      = "${runscope_bucket.bucket.id}"
  test_id        = "${runscope_test.test.id}"
  step_type      = "request"
  url            = "http://example.com"
  method         = "GET"
  variables      = [
  	{
  	   name     = "httpStatus"
  	   source   = "response_status"
  	},
  	{
  	   name     = "httpContentEncoding"
  	   source   = "response_header"
  	   property = "Content-Encoding"
  	},
  ]
  assertions     = [
  	{
  	   source     = "response_status"
       comparison = "equal_number"
       value      = "200"
  	},
  	{
  	   source     = "response_json"
       comparison = "equal"
       value      = "c5baeb4a-2379-478a-9cda-1b671de77cf9",
       property   = "data.id"
  	},
  ],
  headers        = [
  	{
  		header = "Accept-Encoding",
  		value  = "application/json"
  	},
  	{
  		header = "Accept-Encoding",
  		value  = "application/xml"
  	},
  	{
  		header = "Authorization",
  		value  = "Bearer bb74fe7b-b9f2-48bd-9445-bdc60e1edc6a",
	}
  ]
}

resource "runscope_test" "test" {
  bucket_id   = "${runscope_bucket.bucket.id}"
  name        = "runscope test"
  description = "This is a test test..."
}

resource "runscope_bucket" "bucket" {
  name      = "terraform-provider-test"
  team_uuid = "dfb75aac-eeb3-4451-8675-3a37ab421e4f"
}

Argument Reference

The following arguments are supported:

  • bucket_id - (Required) The id of the bucket to associate this step with.
  • test_id - (Required) The id of the test to associate this step with.
  • step_type - (Required) The type of step.
  • request
  • pause
  • condition
  • ghost
  • subtest

Request steps

When creating a request type of step the additional arguments also apply:

  • method - (Required) The HTTP method for this request step.
  • variables - (Optional) A list of variables to extract out of the HTTP response from this request. Variables documented below.
  • assertions - (Optional) A list of assertions to apply to the HTTP response from this request. Assertions documented below.
  • headers - (Optional) A list of headers to apply to the request. Headers documented below.
  • body - (Optional) A string to use as the body of the request.

Variables (variables) supports the following:

  • name - (Required) Name of the variable to define.
  • property - (Required) The name of the source property. i.e. header name or json path
  • source - (Required) The variable source, for list of allowed values see: https://www.runscope.com/docs/api/steps#assertions

Assertions (assertions) supports the following:

Example Assertions

Status Code == 200

"assertions": [
    {
        "source": "response_status",
        "comparison": "equal_number",
        "value": 200
    }
]

JSON element 'address' contains the text "avenue"

"assertions": [
    {
        "source": "response_json",
        "property": "address",
        "comparison": "contains",
        "value": "avenue"
    }
]

Response Time is faster than 1 second.

"assertions": [
    {
        "source": "response_time",
        "comparison": "is_less_than",
        "value": 1000
    }
]

The headers list supports the following:

  • header - (Required) The name of the header
  • value - (Required) The name header value

Attributes Reference

The following attributes are exported:

  • id - The ID of the step.

terraform-provider-runscope's People

Contributors

ewilde avatar kevholditch avatar philwhiteuk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.