terraform-provider-wallarm

command module
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2021 License: MPL-2.0 Imports: 2 Imported by: 0

README

Terraform Provider

Requirements

  • Terraform 0.12.x+
  • Go 1.14+ (to build the provider plugin)

Building The Provider

Clone repository to: $GOPATH/src/terraform-provider-wallarm

$ cd $GOPATH/src/
$ git clone https://github.com/wallarm/terraform-provider-wallarm.git

When it comes to building you have two options:

make install and install it globally

If you don't mind installing the development version of the provider globally, you can use make build in the provider directory which builds and links the binary into your $GOPATH/bin directory.

$ cd $GOPATH/src/terraform-provider-wallarm
$ make install
make build and build a binary locally

If you want to test it locally and have a binary right near this README.md you might use the following commands. They will build a binary terraform-provider-wallarm_v0.0.0 where v0.0.0 is the current version of the provider.

$ cd $GOPATH/src/terraform-provider-wallarm
$ make build
terraform 0.12 and earlier

You have to either sideload a binary with the correct name. Terraform searches for plugins in the format of:

terraform-<TYPE>-<NAME>

In the case above, the plugin is of type provider and of name wallarm as per requirements by Terraform.

terraform 0.13+

The following code is required to be defined in a module:

terraform {
  required_providers {
    wallarm = {
      source = "wallarm/wallarm"
    }
  }
}

then run terraform init

Development The Provider

To start using this provider you have to set up you environment with the required variables:

WALLARM_API_UUID
WALLARM_API_SECRET

Optional: WALLARM_API_HOST with the default value https://api.wallarm.com

Another variant is to define the provider attributes within HCL files:

provider "wallarm" {
  api_host = var.api_host
  api_uuid = var.api_uuid
  api_secret = var.api_secret
}

Create the files variables.tf and variables.auto.tfvars

variables.tf:

variable "api_host" {
  type    = string
  default = "https://us1.api.wallarm.com"
}

variable "api_uuid" {
  type    = string
}

variable "api_secret" {
  type    = string
}

variables.auto.tfvars:

api_uuid = "00000000-0000-0000-0000-000000000000"
api_secret = "000000000000000000000000000000000000000000"

Using The Provider

All the examples have been divided by the resource or datasource name in the examples folder.

For instance, this rule configures the blocking mode for GET requests aiming to dvwa.wallarm-demo.com.

resource "wallarm_rule_mode" "dvwa_mode" {
  mode =  "block"

  action {
    type = "equal"
    value = "dvwa.wallarm-demo.com"
    point = {
      header = "HOST"
    }
  }

  action {
    type = "equal"
    point = {
      method = "GET"
    }
  }
}

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL