Git Product home page Git Product logo

hashicorp / terraform-provider-runscope Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 25.0 27.4 MB

Terraform runscope provider. Please note: This Terraform provider is archived per our provider archiving process: https://terraform.io/docs/internals/archiving.html

Home Page: https://www.terraform.io/docs/providers/runscope/

License: Other

Makefile 3.35% Go 90.03% Shell 3.15% HTML 3.47%
terraform terraform-provider runscope

terraform-provider-runscope's Introduction

Please note: This Terraform provider is archived, per our provider archiving process. What does this mean?

  1. The code repository and all commit history will still be available.
  2. Existing released binaries will remain available on the releases site.
  3. Issues and pull requests are not being monitored.
  4. New releases will not be published.

If anyone from the community or an interested third party is willing to maintain it, they can fork the repository and publish it to the Terraform Registry. If you are interested in maintaining this provider, please reach out to the Terraform Provider Development Program at [email protected].


Build Status

Terraform Runscope Provider

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

Requirements

  • Terraform 0.10.x
  • Go 1.11 (to build the provider plugin)

Installing

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

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.

Developing

Building The Provider

Clone repository to: $GOPATH/src/github.com/terraform-providers/terraform-provider-runscope

$ mkdir -p $GOPATH/src/github.com/terraform-providers; cd $GOPATH/src/github.com/terraform-providers
$ git clone [email protected]:terraform-providers/terraform-provider-runscope

Enter the provider directory and build the provider

$ cd $GOPATH/src/github.com/terraform-providers/terraform-provider-runscope
$ make build

Using the provider

See examples

See runscope providers documentation

Developing the Provider

If you wish to work on the provider, you'll first need Go installed on your machine (version 1.11+ is required). You'll also need to correctly setup a 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.

$ make build
...
$ $GOPATH/bin/terraform-provider-runscope
...

Running the integration tests

make TF_ACC=1 RUNSCOPE_TEAM_ID=xxx RUNSCOPE_ACCESS_TOKEN=xxx RUNSCOPE_INTEGRATION_DESC="Slack: #test1 channel, send message on all test runs"

Environment variables Description
TF_ACC 1 runs acceptance tests, do not set to skip acceptance tests
RUNSCOPE_TEAM_ID Runscope team uuid
RUNSCOPE_ACCESS_TOKEN Runscope access token
RUNSCOPE_INTEGRATION_DESC Description that matches a pre-existing runscope integration associated with your account

Vendoring / dependency management

Dependencies are managed using Go Modules

Add or update a dependency

$ GO111MODULE=on go get <module>@<version>
$ GO111MODULE=on go mod tidy

For the time being we will continue to vendor

$ GO111MODULE=on go mod vendor

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 :

terraform-provider-runscope's People

Contributors

aicarmic avatar appilon avatar catsby avatar cgriggs01 avatar ewilde avatar ixalon avatar katbyte avatar kevholditch avatar marek130 avatar martinssipenko avatar paultyng avatar philwhiteuk avatar radeksimko avatar timothyclifford avatar unya avatar watsonlu avatar xonstone avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-runscope's Issues

Changes to scripts and before_scripts not applied

In the test step properties before_scripts and scripts, changes to the values are not applied when applying the plan. Unless a new resource is being created from scratch.

The workaround is to destroy the resources and reapply, but then the test history is lost.

[PROPOSAL] Switch to Go Modules

As part of the preparation for Terraform v0.12, we would like to migrate all providers to use Go Modules. We plan to continue checking dependencies into vendor/ to remain compatible with existing tooling/CI for a period of time, however go modules will be used for management. Go Modules is the official solution for the go programming language, we understand some providers might not want this change yet, however we encourage providers to begin looking towards the switch as this is how we will be managing all Go projects in the future. Would maintainers please react with ๐Ÿ‘ for support, or ๐Ÿ‘Ž if you wish to have this provider omitted from the first wave of pull requests. If your provider is in support, we would ask that you avoid merging any pull requests that mutate the dependencies while the Go Modules PR is open (in fact a total codefreeze would be even more helpful), otherwise we will need to close that PR and re-run go mod init. Once merged, dependencies can be added or updated as follows:

$ GO111MODULE=on go get github.com/some/module@master
$ GO111MODULE=on go mod tidy
$ GO111MODULE=on go mod vendor

GO111MODULE=on might be unnecessary depending on your environment, this example will fetch a module @ master and record it in your project's go.mod and go.sum files. It's a good idea to tidy up afterward and then copy the dependencies into vendor/. To remove dependencies from your project, simply remove all usage from your codebase and run:

$ GO111MODULE=on go mody tidy
$ GO111MODULE=on go mod vendor

Thank you sincerely for all your time, contributions, and cooperation!

Can't Create Other Step Types

Hi,

I cannot figure out how to create other step types like 'pause' and or 'condition'. The documentation seems to indicate that this is possible. Can you provide an example?

Thanks!

Blazemeter compatibility

Hi there!

Is this provider compatible with Blazemeter? Runscope was integrated into Blazemeter, so not sure if this provider is now defunct, or at least needs renaming?

Schedule for interval 1d returns float.

Issue

When setting a runscope schedule with interval 1d each plan returns a change case the api returns 1.0d causing a new resource.

Versions

terraform v0.13.2
terraform-provider-runscope v0.6.0

Outputs

-/+ resource "runscope_schedule" "schedule" {
        bucket_id      = "xxxxxx"
        environment_id = "xxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx"
      ~ id             = "xxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" -> (known after apply)
      ~ interval       = "1.0d" -> "1d" # forces replacement
        note           = "Schedule"
        test_id        = "xxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxx"

Provider Hangs Endlessly When Using for_each

When you try to create anything with a for_each construct with on object with a lot of properties (I think around 20)the provider will hang endlessly. It works for short iterations. For example:

  for_each = module.stack.tests
  bucket_id = module.stack.bucket.id
  step_type = "request"
  test_id = each.value.id
  ...

Output:

runscope_step.internal["naa"]: Still creating... [1m30s elapsed]
runscope_step.internal["ayca"]: Still creating... [1m40s elapsed]
runscope_step.internal["rome"]: Still creating... [1m39s elapsed]
runscope_step.internal["bcaa"]: Still creating... [1m40s elapsed]

Ruscope test steps order

Hey,
today I faced the issue, that there is no way to define the order of the steps. And since runscope test steps can depend on each other, therefore the order is important.

Directive depends_on can be used to chain the dependency between tests and it works fine until you need to insert a new test between the existing ones and that doesn't work, because terraform will simply create the new test as last one.

The workaround I figured is to state the test order in the resources name and chain dependencies between each other like:

resource "runscope_step" "create_test_01" {
    depends_on = ["runscope_step.test00"]
    ...
}

resource "runscope_step" "delete_test_02" {
    depends_on = ["runscope_step.create_test_01"]
    ...
}

# ... etc, etc

The serious drawback of such approach is if I want to put the update_test_02 between these two, I would need to rename all the tests after this one, incrementing the order in the resource name like:

resource "runscope_step" "create_test_01" {
    depends_on = ["runscope_step.test00"]
    ...
}

resource "runscope_step" "update_test_02" {
    depends_on = ["runscope_step.create_test_01"]
    ...
}

resource "runscope_step" "delete_test_03" {
    depends_on = ["runscope_step.update_test_02"]
    ...
}

# ... etc, etc

In this case, terraform will remove all the test steps whose names were changed and create them in the correct order. But updating manually the name of all the test isn't a good option.

Do you have any ideas how that can be resolved?

The only viable idea I have is to introduce a new resource type called runscope_steps which actually takes the array of steps and preserves the order.

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.