Skip to content

Commit

Permalink
rename and regenerate all pages
Browse files Browse the repository at this point in the history
  • Loading branch information
Integralist committed Jan 26, 2021
1 parent 2671c9f commit 0967738
Show file tree
Hide file tree
Showing 70 changed files with 197 additions and 23 deletions.
36 changes: 36 additions & 0 deletions docs/data-sources/ip_ranges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
layout: "fastly"
page_title: "Fastly: fastly_ip_ranges"
sidebar_current: "docs-fastly-datasource-ip_ranges"
description: |-
Get information on Fastly IP ranges.
---

# fastly_ip_ranges

Use this data source to get the [IP ranges][1] of Fastly edge nodes.

## Example Usage

```hcl
data "fastly_ip_ranges" "fastly" {}
resource "aws_security_group" "from_fastly" {
name = "from_fastly"
ingress {
from_port = "443"
to_port = "443"
protocol = "tcp"
cidr_blocks = ["${data.fastly_ip_ranges.fastly.cidr_blocks}"]
ipv6_cidr_blocks = ["${data.fastly_ip_ranges.fastly.ipv6_cidr_blocks}"]
}
}
```

## Attributes Reference

* `cidr_blocks` - The lexically ordered list of ipv4 CIDR blocks.
* `ipv6_cidr_blocks` - The lexically ordered list of ipv6 CIDR blocks.

[1]: https://docs.fastly.com/guides/securing-communications/accessing-fastlys-ip-ranges
148 changes: 148 additions & 0 deletions docs/data-sources/waf_rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
layout: "fastly"
page_title: "Fastly: fastly_waf_rules"
sidebar_current: "docs-fastly-datasource-waf_rules"
description: |-
Get information on Fastly WAF rules.
---

-> **Note:** This data source is only available from 0.20.0 of the Fastly terraform provider.

# fastly_waf_rules

Use this data source to get the [WAF rules][1] of Fastly. A set of third-party rules from the OWASP Core Ruleset, commercial sources, and open source, in addition to Fastly-generated rules.
They offer protection from injection attacks and cross site scripting amongst other key application-layer attacks.

## Example Usage

Usage with publishers Filter:

```hcl
data "fastly_waf_rules" "owasp" {
publishers = ["owasp"]
}
```

Usage with tags filter:

```hcl
data "fastly_waf_rules" "tag" {
tags = ["language-html", "language-jsp"]
}
```

Usage with exclude filter:

```hcl
data "fastly_waf_rules" "owasp_with_exclusions" {
publishers = ["owasp"]
exclude_modsec_rule_ids = [1010090]
}
```

Usage without filters:

```hcl
data "fastly_waf_rules" "all" {
# This will retrieve the entire list of rules available from the API at the time.
}
```

Usage with WAF configuration resource:

```hcl
variable "type_status" {
type = map(string)
default = {
score = "score"
threshold = "log"
strict = "log"
}
}
resource "fastly_service_v1" "demo" {
name = "demofastly"
domain {
name = "example.com"
comment = "demo"
}
backend {
address = "127.0.0.1"
name = "origin1"
port = 80
}
condition {
name = "WAF_Prefetch"
type = "PREFETCH"
statement = "req.backend.is_origin"
}
# This condition will always be false
# adding it to the response object created below
# prevents Fastly from returning a 403 on all of your traffic.
condition {
name = "WAF_always_false"
statement = "false"
type = "REQUEST"
}
response_object {
name = "WAF_Response"
status = "403"
response = "Forbidden"
content_type = "text/html"
content = "<html><body>Forbidden</body></html>"
request_condition = "WAF_always_false"
}
waf {
prefetch_condition = "WAF_Prefetch"
response_object = "WAF_Response"
}
force_destroy = true
}
data "fastly_waf_rules" "owasp" {
publishers = ["owasp"]
}
resource "fastly_service_waf_configuration" "waf" {
waf_id = fastly_service_v1.demo.waf[0].waf_id
http_violation_score_threshold = 100
dynamic "rule" {
for_each = data.fastly_waf_rules.owasp.rules
content {
modsec_rule_id = rule.value.modsec_rule_id
revision = rule.value.latest_revision_number
status = lookup(var.type_status, rule.value.type, "log")
}
}
}
```

## Argument Reference

~> **Warning:** The data source's filters are applied using an **AND** boolean operator, so depending on the combination of filters, they may become mutually exclusive.

* `publishers` - Inclusion filter by WAF rule's publishers.
* `tags` - Inclusion filter by WAF rule's tags.
* `exclude_modsec_rule_ids` - Exclusion filter by WAF rule's ModSecurity ID.

## Attribute Reference

* `rules` - The Web Application Firewall's rules result set.

~> **Warning:** Deprecated rules will not be present on this data source's result set.

The `rules` block supports:

* `modsec_rule_id` - The rule's modsecurity ID.
* `latest_revision_number` - The rule's latest revision.
* `type` - The rule's type.

[1]: https://developer.fastly.com/reference/api/waf/rules/
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{define "fastly_ip_ranges"}}---
{{define "ip_ranges"}}---
layout: "fastly"
page_title: "Fastly: fastly_ip_ranges"
sidebar_current: "docs-fastly-datasource-ip_ranges"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{define "fastly_waf_rules"}}---
{{define "waf_rules"}}---
layout: "fastly"
page_title: "Fastly: fastly_waf_rules"
sidebar_current: "docs-fastly-datasource-waf_rules"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 11 additions & 21 deletions scripts/website/parse-templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,63 +37,52 @@ func main() {
var dataPages = []Page{
{
name: "ip_ranges",
path: docsDir + "data-sources/ip_ranges.html.markdown",
path: docsDir + "data-sources/ip_ranges.md",
},
{
name: "waf_rules",
path: docsDir + "data-sources/waf_rules.html.markdown",
path: docsDir + "data-sources/waf_rules.md",
},
}

var resourcePages = []Page{
{
name: "service_v1",
path: docsDir + "resources/service_v1.html.markdown",
path: docsDir + "resources/service_v1.md",
Data: PageData{
"vcl",
},
},
{
name: "service_compute",
path: docsDir + "resources/service_compute.html.markdown",
path: docsDir + "resources/service_compute.md",
Data: PageData{
"wasm",
},
},
{
name: "service_dictionary_items_v1",
path: docsDir + "resources/service_dictionary_items_v1.html.markdown",
path: docsDir + "resources/service_dictionary_items_v1.md",
},
{
name: "service_acl_entries_v1",
path: docsDir + "resources/service_acl_entries_v1.html.markdown",
path: docsDir + "resources/service_acl_entries_v1.md",
},
{
name: "service_dynamic_snippet_content_v1",
path: docsDir + "resources/service_dynamic_snippet_content_v1.html.markdown",
path: docsDir + "resources/service_dynamic_snippet_content_v1.md",
},
{
name: "service_waf_configuration",
path: docsDir + "resources/service_waf_configuration.html.markdown",
path: docsDir + "resources/service_waf_configuration.md",
},
{
name: "user_v1",
path: docsDir + "resources/user_v1.html.markdown",
path: docsDir + "resources/user_v1.md",
},
}

// TODO(integralist): redesign the template parsing so that we don't need
// a root node of the pages tree structure. Historically the 'no-op' file
// would have referenced a fastly_erb/fastly.erb file containing a Ruby based
// HTML template file (as the terraform.io used to run on a Ruby platform).
// This file would define the HTML for a side-menu bar that linked to other
// pages and resources.
var pages = append(resourcePages, Page{
name: "no-op",
path: docsDir + "no_op",
DataMenu: generateMenuItems("data-sources", dataPages),
ResourceMenu: generateMenuItems("resources", resourcePages),
})
pages := append(resourcePages, dataPages...)

renderPages(getTemplate(tmplDir), pages)
}
Expand Down Expand Up @@ -136,6 +125,7 @@ func getTemplate(tmplDir string) *template.Template {
}
return nil
})
fmt.Println(templateFiles)
return template.Must(template.ParseFiles(templateFiles...))
}

Expand Down

0 comments on commit 0967738

Please sign in to comment.