- Website: https://www.terraform.io
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:
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
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
The following code is required to be defined in a module:
terraform {
required_version ">= 0.15.5"
required_providers {
wallarm = {
source = "wallarm/wallarm"
}
}
}
then run terraform init
To start using this provider you have to set up you environment with the required variables:
WALLARM_API_TOKEN
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_token = var.api_token
}
Create the files variables.tf
and variables.auto.tfvars
variables.tf
:
variable "api_host" {
type = string
default = "https://us1.api.wallarm.com"
}
variable "api_token" {
type = string
}
variables.auto.tfvars
:
api_token = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
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"
}
}
}