Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.0.0 Upgrade #26

Merged
merged 16 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 2.0.0 (Unreleased)

As we near certification readiness, we've made lots of changes to the provider. Backwards incompatible changes have been made to the Incap Rule resources. Please review the documentation. Changes below:

* All acceptance and unit tests now pass. There was a race condition issue with dependencies - see this Hashicorp issues: https://github.com/hashicorp/terraform/issues/23169 and https://github.com/hashicorp/terraform/issues/23635
* Migrate `resource_incap_rule` to use APIv2. See updated documentation and example files for the latest resource spec.
* Add fixes for data center and data center server result codes (oscillation between strings and ints)
* Fix importing of various resources: data center, data center server, Incap Rule, etc.
* Fix ceriticate argument requirements (thanks @areifert)
* Added GitHub workflow integration for side builds prior to certification (thanks @pklime2)
* Upgrade to Terraform v0.12
* Migrate to standalone Terraform SDK
* Started to improve consistency of error log messages (Site IDs, Rule IDs, etc.)

## 1.0.0 (Unreleased)

Initial release of the Incapsula Terraform Provider.
36 changes: 3 additions & 33 deletions examples/example.tf
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,22 @@ resource "incapsula_data_center" "example-data-center-test" {
site_id = "${incapsula_site.example-site.id}"
name = "Example data center test"
server_address = "8.8.4.8"
is_content = "yes"
is_content = "true"
}

resource "incapsula_data_center" "example-data-center" {
site_id = "${incapsula_site.example-site.id}"
name = "Example data center"
server_address = "8.8.4.4"
is_content = "yes"
is_content = "true"
}

# Data Center Servers
resource "incapsula_data_center_server" "example-data-center-server" {
dc_id = "${incapsula_data_center.example-data-center.id}"
site_id = "${incapsula_site.example-site.id}"
server_address = "4.4.4.4"
is_standby = "no"
is_standby = "false"
}

###################################################################
Expand Down Expand Up @@ -278,152 +278,122 @@ resource "incapsula_security_rule_exception" "example-waf-sql-injection-rule-exc

# Incap Rule: Alert
resource "incapsula_incap_rule" "example-incap-rule-alert" {
priority = "1"
name = "Example incap rule alert"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_ALERT"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Require javascript support
resource "incapsula_incap_rule" "example-incap-rule-require-js-support" {
priority = "1"
name = "Example incap rule require javascript support 3"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_INTRUSIVE_HTML"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block IP
resource "incapsula_incap_rule" "example-incap-rule-block-ip" {
priority = "1"
name = "Example incap rule block ip"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK_IP"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block Request
resource "incapsula_incap_rule" "example-incap-rule-block-request" {
priority = "1"
name = "Example incap rule block request"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block Session
resource "incapsula_incap_rule" "example-incap-rule-block-session" {
priority = "1"
name = "Example incap rule block session"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK_USER"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Delete Cookie (ADR)
resource "incapsula_incap_rule" "example-incap-rule-delete-cookie" {
priority = "1"
name = "Example incap rule delete cookie"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_DELETE_COOKIE"
filter = "Full-URL == \"/someurl\""
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Delete Header (ADR)
resource "incapsula_incap_rule" "example-incap-rule-delete-header" {
priority = "1"
name = "Example incap rule delete header"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_DELETE_HEADER"
filter = "Full-URL == \"/someurl\""
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Forward to Data Center (ADR)
resource "incapsula_incap_rule" "example-incap-rule-fwd-to-data-center" {
priority = "1"
name = "Example incap rule forward to data center"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_FORWARD_TO_DC"
filter = "Full-URL == \"/someurl\""
dc_id = "${incapsula_data_center.example-data-center.id}"
allow_caching = "false"
enabled = "true"
}

# Incap Rule: Redirect (ADR)
resource "incapsula_incap_rule" "example-incap-rule-redirect" {
priority = "1"
name = "Example incap rule redirect"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REDIRECT"
filter = "Full-URL == \"/someurl\""
response_code = "302"
from = "https://site1.com/url1"
to = "https://site2.com/url2"
enabled = "true"
}

# Incap Rule: Require Cookie Support (IncapRule)
resource "incapsula_incap_rule" "example-incap-rule-require-cookie-support" {
priority = "1"
name = "Example incap rule require cookie support"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_RETRY"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Rewrite Cookie (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-cookie" {
priority = "18"
name = "Example incap rule rewrite cookie"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_COOKIE"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "some_optional_value"
to = "some_new_value"
allow_caching = "false"
rewrite_name = "my_cookie_name"
enabled = "true"
}

# Incap Rule: Rewrite Header (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-header" {
priority = "17"
name = "Example incap rule rewrite header"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_HEADER"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "some_optional_value"
to = "some_new_value"
allow_caching = "false"
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Rewrite URL (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-url" {
priority = "1"
name = "ExampleRewriteURL"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_URL"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "*"
to = "/redirect"
allow_caching = "false"
rewrite_name = "my_test_header"
enabled = "true"
}
37 changes: 3 additions & 34 deletions examples/security_rules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,21 @@ resource "incapsula_data_center" "example-data-center-test" {
site_id = "${incapsula_site.example-site.id}"
name = "Example data center test"
server_address = "8.8.4.8"
is_content = "yes"
is_content = "true"
}

resource "incapsula_data_center" "example-data-center" {
site_id = "${incapsula_site.example-site.id}"
name = "Example data center"
server_address = "8.8.4.4"
is_content = "yes"
is_content = "true"
}

Data Center Servers
resource "incapsula_data_center_server" "example-data-center-server" {
dc_id = "${incapsula_data_center.example-data-center.id}"
site_id = "${incapsula_site.example-site.id}"
server_address = "4.4.4.4"
is_standby = "no"
is_standby = "false"
}

####################################################################
Expand Down Expand Up @@ -132,152 +131,122 @@ resource "incapsula_acl_security_rule" "example-global-whitelist-ip-rule" {

# Incap Rule: Alert
resource "incapsula_incap_rule" "example-incap-rule-alert" {
priority = "1"
name = "Example incap rule alert"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_ALERT"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Require javascript support
resource "incapsula_incap_rule" "example-incap-rule-require-js-support" {
priority = "1"
name = "Example incap rule require javascript support 3"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_INTRUSIVE_HTML"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block IP
resource "incapsula_incap_rule" "example-incap-rule-block-ip" {
priority = "1"
name = "Example incap rule block ip"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK_IP"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block Request
resource "incapsula_incap_rule" "example-incap-rule-block-request" {
priority = "1"
name = "Example incap rule block request"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Block Session
resource "incapsula_incap_rule" "example-incap-rule-block-session" {
priority = "1"
name = "Example incap rule block session"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_BLOCK_USER"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Delete Cookie (ADR)
resource "incapsula_incap_rule" "example-incap-rule-delete-cookie" {
priority = "1"
name = "Example incap rule delete cookie"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_DELETE_COOKIE"
filter = "Full-URL == \"/someurl\""
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Delete Header (ADR)
resource "incapsula_incap_rule" "example-incap-rule-delete-header" {
priority = "1"
name = "Example incap rule delete header"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_DELETE_HEADER"
filter = "Full-URL == \"/someurl\""
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Forward to Data Center (ADR)
resource "incapsula_incap_rule" "example-incap-rule-fwd-to-data-center" {
priority = "1"
name = "Example incap rule forward to data center"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_FORWARD_TO_DC"
filter = "Full-URL == \"/someurl\""
dc_id = "${incapsula_data_center.example-data-center.id}"
allow_caching = "false"
enabled = "true"
}

# Incap Rule: Redirect (ADR)
resource "incapsula_incap_rule" "example-incap-rule-redirect" {
priority = "1"
name = "Example incap rule redirect"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REDIRECT"
filter = "Full-URL == \"/someurl\""
response_code = "302"
from = "https://site1.com/url1"
to = "https://site2.com/url2"
enabled = "true"
}

# Incap Rule: Require Cookie Support (IncapRule)
resource "incapsula_incap_rule" "example-incap-rule-require-cookie-support" {
priority = "1"
name = "Example incap rule require cookie support"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_RETRY"
filter = "Full-URL == \"/someurl\""
enabled = "true"
}

# Incap Rule: Rewrite Cookie (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-cookie" {
priority = "18"
name = "Example incap rule rewrite cookie"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_COOKIE"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "some_optional_value"
to = "some_new_value"
allow_caching = "false"
rewrite_name = "my_cookie_name"
enabled = "true"
}

# Incap Rule: Rewrite Header (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-header" {
priority = "17"
name = "Example incap rule rewrite header"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_HEADER"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "some_optional_value"
to = "some_new_value"
allow_caching = "false"
rewrite_name = "my_test_header"
enabled = "true"
}

# Incap Rule: Rewrite URL (ADR)
resource "incapsula_incap_rule" "example-incap-rule-rewrite-url" {
priority = "1"
name = "ExampleRewriteURL"
site_id = "${incapsula_site.example-site.id}"
action = "RULE_ACTION_REWRITE_URL"
filter = "Full-URL == \"/someurl\""
add_missing = "true"
from = "*"
to = "/redirect"
allow_caching = "false"
rewrite_name = "my_test_header"
enabled = "true"
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ module github.com/terraform-providers/terraform-provider-incapsula

go 1.13

require github.com/hashicorp/terraform v0.12.18
require github.com/hashicorp/terraform-plugin-sdk v1.0.0
Loading