Skip to content

Commit

Permalink
Check if docs need to be regenerated (#362)
Browse files Browse the repository at this point in the history
* create github action for diffing content

* update action versions

* move to go mod pattern for installing dev tools

* remove redundant cd

* missing error in print

* delete me

* missing error message in output

* remove generated binary

* add binary to gitignore

* update makefile

* remove print from script

* update description to cause ci workflow to fail!?

* update docs!

* Revert "update description to cause ci workflow to fail!?"

This reverts commit 6647eba.

* define make target for easily typing diff command after docs

* fix diff command so it actually returns an exit code!

* inline the git diff

* update docs to make ci pass

* some changed files don't suggest a change in docs is necessary
  • Loading branch information
Integralist authored Feb 4, 2021
1 parent 13d1c04 commit 0de8070
Show file tree
Hide file tree
Showing 616 changed files with 75,739 additions and 88,984 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,37 @@ jobs:
${{ runner.os }}-go-mod-
- name: Test
run: make test
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Restore cached binaries
id: cache
uses: actions/cache@v2
with:
path: ~/go/bin
key: ${{ runner.os }}-go-bin-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-bin-
- name: Restore cached modules dependencies
uses: actions/cache@v2
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-mod-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make dependencies
shell: bash
- name: Generate Docs
run: |
make generate-docs
- name: Check diff
run: |
git diff --exit-code --ignore-all-space ./docs/
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ website/node_modules
*.test
*.iml

# ignore the compiled binary when running `go install`
terraform-provider-fastly

website/vendor

# Test exclusions
Expand Down
14 changes: 11 additions & 3 deletions GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,18 @@ test-compile:
fi
go test -c $(TEST) $(TESTARGS)

generate-docs:
dependencies:
@echo "Download go.mod dependencies"
@go mod download

install-tools: dependencies
@echo "Installing tools from tools/tools.go"
@cat tools/tools.go | grep _ | awk -F '"' '{print $$2}' | xargs -tI {} go install {}

generate-docs: install-tools
go run scripts/generate-docs.go

validate-docs:
validate-docs: install-tools
tfplugindocs validate

.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile validate-docs generate-docs
.PHONY: build test testacc vet fmt fmtcheck errcheck test-compile validate-docs generate-docs install-tools dependencies
2 changes: 1 addition & 1 deletion docs/data-sources/ip_ranges.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ resource "aws_security_group" "from_fastly" {

- **id** (String) The ID of this resource.

### Read-only
### Read-Only

- **cidr_blocks** (List of String) The lexically ordered list of ipv4 CIDR blocks.
- **ipv6_cidr_blocks** (List of String) The lexically ordered list of ipv6 CIDR blocks.
4 changes: 2 additions & 2 deletions docs/data-sources/waf_rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ The `rules` block supports:
- **publishers** (List of String) A list of publishers to be used as filters for the data set.
- **tags** (List of String) A list of tags to be used as filters for the data set.

### Read-only
### Read-Only

- **rules** (List of Object) The list of rules that results from any given combination of filters. (see [below for nested schema](#nestedatt--rules))

<a id="nestedatt--rules"></a>
### Nested Schema for `rules`

Read-only:
Read-Only:

- **latest_revision_number** (Number)
- **modsec_rule_id** (Number)
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/service_acl_entries_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,6 @@ Optional:
- **negated** (Boolean) A boolean that will negate the match if true
- **subnet** (String) An optional subnet mask applied to the IP address

Read-only:
Read-Only:

- **id** (String) The ID of this resource.
2 changes: 1 addition & 1 deletion docs/resources/service_compute.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ $ terraform import fastly_service_compute.demo xxxxxxxxxxxxxxxxxxxx
- **syslog** (Block Set) (see [below for nested schema](#nestedblock--syslog))
- **version_comment** (String) Description field for the version

### Read-only
### Read-Only

- **active_version** (Number) The currently active version of your Fastly Service
- **cloned_version** (Number) The latest cloned version by the provider. The value gets only set after running `terraform apply`
Expand Down
10 changes: 5 additions & 5 deletions docs/resources/service_v1.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ $ terraform import fastly_service_v1.demo xxxxxxxxxxxxxxxxxxxx
- **version_comment** (String) Description field for the version
- **waf** (Block List, Max: 1) (see [below for nested schema](#nestedblock--waf))

### Read-only
### Read-Only

- **active_version** (Number) The currently active version of your Fastly Service
- **cloned_version** (Number) The latest cloned version by the provider. The value gets only set after running `terraform apply`
Expand All @@ -306,7 +306,7 @@ Required:

- **name** (String) A unique name to identify this ACL

Read-only:
Read-Only:

- **acl_id** (String) The ID of the ACL

Expand Down Expand Up @@ -430,7 +430,7 @@ Optional:

- **write_only** (Boolean) If `true`, the dictionary is a private dictionary, and items are not readable in the UI or via API. Default is `false`. It is important to note that changing this attribute will delete and recreate the dictionary, discard the current items in the dictionary. Using a write-only/private dictionary should only be done if the items are managed outside of Terraform

Read-only:
Read-Only:

- **dictionary_id** (String) The ID of the dictionary

Expand Down Expand Up @@ -465,7 +465,7 @@ Optional:

- **priority** (Number) Priority determines the ordering for multiple snippets. Lower numbers execute first. Defaults to `100`

Read-only:
Read-Only:

- **snippet_id** (String) The ID of the dynamic snippet

Expand Down Expand Up @@ -1114,6 +1114,6 @@ Optional:
- **disabled** (Boolean) A flag used to completely disable a Web Application Firewall. This is intended to only be used in an emergency
- **prefetch_condition** (String) The `condition` to determine which requests will be run past your Fastly WAF. This `condition` must be of type `PREFETCH`. For detailed information about Conditionals, see [Fastly's Documentation on Conditionals](https://docs.fastly.com/en/guides/using-conditions)

Read-only:
Read-Only:

- **waf_id** (String) The ID of the WAF
2 changes: 1 addition & 1 deletion docs/resources/service_waf_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,6 @@ Optional:

- **modsec_rule_ids** (Set of Number) Set of modsecurity IDs to be excluded. No rules should be provided when `exclusion_type` is `waf`. The rules need to be configured on the Web Application Firewall to be excluded

Read-only:
Read-Only:

- **number** (Number) The numeric ID assigned to the WAF Rule Exclusion
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ go 1.14
require (
github.com/ajg/form v0.0.0-20160822230020-523a5da1a92f // indirect
github.com/fastly/go-fastly/v3 v3.0.0
github.com/google/go-cmp v0.3.0
github.com/google/go-cmp v0.5.2
github.com/google/jsonapi v0.0.0-20180313013858-2dcc18f43696 // indirect
github.com/hashicorp/terraform-plugin-docs v0.4.0
github.com/hashicorp/terraform-plugin-sdk v1.1.0
github.com/stretchr/testify v1.3.0
github.com/stretchr/testify v1.6.1
)
Loading

0 comments on commit 0de8070

Please sign in to comment.