Skip to content

Commit

Permalink
Feat edge firewall edge function (#112)
Browse files Browse the repository at this point in the history
* feat: Data source support to Edge Firewall - Edge Functions instance API #minor
  • Loading branch information
diegoazion authored Oct 16, 2023
1 parent 8e99b43 commit 216c3f0
Show file tree
Hide file tree
Showing 17 changed files with 651 additions and 102 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/checks.yml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/code-check-and-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: Code Check and Doc Gen

on: [pull_request]

permissions:
contents: read

jobs:
# Ensure the project can build first
build:
name: Build
runs-on: ubuntu-20.04
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
- name: Get dependencies
run: |
go mod tidy
git diff --compact-summary --exit-code || \
(echo; echo "Unexpected difference after 'go mod tidy'. Run 'go mod tidy' command and commit."; exit 1)
- name: Build
run: |
make install
fmt:
name: go fmt
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
- run: |
if [ "$(go fmt ./... | wc -l)" -gt 0 ]; then
echo "::error::'go fmt' found required formatting changes. Run 'make fmt' on your branch."
exit 1;
fi
gosec:
name: Run Gosec Security Scanner
needs: [ build ]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: securego/gosec@master
env:
GOROOT: ''
with:
args: ./...

vet:
name: go vet
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
- run: go vet ./...

lint:
name: golangcli-lint
needs: [ build ]
runs-on: ubuntu-20.04
steps:
- name: Setting GIT
run: git config --global url."https://${{ secrets.GLOBAL_TOKEN }}:[email protected]/aziontech".insteadOf "https://github.com/aziontech"
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
- uses: golangci/golangci-lint-action@v3
with:
version: latest
args: "--config .golintci.yml"
only-new-issues: true

generate:
name: go generate
needs: [build]
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache: true
# Use git add -N . to ensure that new files are listed in the git diff check
- run: |
go generate ./...
git add -N .
git diff --exit-code || \
(echo; echo "Unexpected difference after code generation. Run 'make generate' command and commit."; exit 1)
29 changes: 0 additions & 29 deletions .github/workflows/lint.yml

This file was deleted.

33 changes: 11 additions & 22 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,20 @@ GORELEASER ?= $(shell which goreleaser)
GOFMT ?= $(shell which gofmt)
GOFMT_FILES?=$$(find . -name '*.go')

default: build
default: install

install: checks
go install -ldflags="-X github.com/aziontech/terraform-provider-azion/main.version=$(VERSION)"
install:
go mod tidy
go install .

build: checks
build:
$(GO) build -ldflags="-X github.com/aziontech/terraform-provider-azion/main.version=$(VERSION)" -o terraform-provider-azion;
fmt:
go fmt ./...

vet:
go vet ./...

checks:
@go fmt ./...
@staticcheck ./...
@go vet ./...
generate:
go generate ./...

.PHONY: release
release: tools
Expand Down Expand Up @@ -99,18 +100,6 @@ get-gosec-deps:
https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(GOBIN) v2.15.0 ;\
fi

docGen: tools
chmod u+r+x ./scripts/generate-docs.sh
@sh -c "'$(CURDIR)/scripts/generate-docs.sh'"

tools:
@echo "==> Installing development tooling..."
go generate -tags tools tools/tools.go

generate-changelog:
@echo "==> Generating changelog..."
@sh -c "'$(CURDIR)/scripts/generate-changelog.sh'"

func-init:
@rm -rf func-tests/.terraform.lock.hcl
@rm -rf func-tests/.terraform
Expand Down
50 changes: 50 additions & 0 deletions docs/data-sources/edge_firewall_edge_function_instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "azion_edge_firewall_edge_function_instance Data Source - terraform-provider-azion"
subcategory: ""
description: |-
---

# azion_edge_firewall_edge_function_instance (Data Source)



## Example Usage

```terraform
data "azion_edge_firewall_edge_function_instance" "example" {
edge_firewall_id = 1234567890
results = {
edge_function_instance_id = 123456
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `edge_firewall_id` (Number) Numeric identifier of the Edge Firewall
- `results` (Attributes) (see [below for nested schema](#nestedatt--results))

### Read-Only

- `id` (String) Numeric identifier of the data source.
- `schema_version` (Number) Schema Version.

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

Required:

- `edge_function_instance_id` (Number) ID of the edge firewall edge functions instance.

Read-Only:

- `edge_function_id` (Number) ID of the Edge Function for Edge Firewall you with to configure.
- `json_args` (String) Requisition status code and message.
- `last_editor` (String) Last editor of the edge firewall edge functions instance.
- `last_modified` (String) Last modified timestamp of the edge firewall edge functions instance.
- `name` (String) Name of the edge firewall edge functions instance.
66 changes: 66 additions & 0 deletions docs/data-sources/edge_firewall_edge_functions_instance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "azion_edge_firewall_edge_functions_instance Data Source - terraform-provider-azion"
subcategory: ""
description: |-
---

# azion_edge_firewall_edge_functions_instance (Data Source)



## Example Usage

```terraform
data "azion_edge_firewall_edge_functions_instance" "example" {
edge_firewall_id = 1234567890
page = 1
page_size = 10
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `edge_firewall_id` (Number) Numeric identifier of the Edge Firewall

### Optional

- `page` (Number) The page number of edge firewalls.
- `page_size` (Number) The Page Size number of edge firewalls.

### Read-Only

- `counter` (Number) The total number of edge firewalls.
- `id` (String) Numeric identifier of the data source.
- `links` (Attributes) (see [below for nested schema](#nestedatt--links))
- `results` (Attributes List) (see [below for nested schema](#nestedatt--results))
- `schema_version` (Number) Schema Version.
- `total_pages` (Number) The total number of pages.

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

Read-Only:

- `next` (String)
- `previous` (String)


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

Required:

- `edge_function_instance_id` (Number) ID of the edge firewall edge functions instance.

Read-Only:

- `edge_function` (Number) ID of the Edge Function for Edge Firewall you with to configure.
- `json_args` (String) Requisition status code and message.
- `last_editor` (String) Last editor of the edge firewall edge functions instance.
- `last_modified` (String) Last modified timestamp of the edge firewall edge functions instance.
- `name` (String) Name of the edge firewall edge functions instance.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The Azion provider is used to interact with resources supported by Azion. The pr
terraform {
required_providers {
azion = {
source = "aziontech/azion"
source = "aziontech/azion"
version = "~≳ <version>"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
data "azion_edge_firewall_edge_function_instance" "example" {
edge_firewall_id = 1234567890
results = {
edge_function_instance_id = 123456
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
data "azion_edge_firewall_edge_functions_instance" "example" {
edge_firewall_id = 1234567890
page = 1
page_size = 10
}
2 changes: 1 addition & 1 deletion examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
terraform {
required_providers {
azion = {
source = "aziontech/azion"
source = "aziontech/azion"
version = "~≳ <version>"
}
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/aziontech/terraform-provider-azion
go 1.21

require (
github.com/aziontech/azionapi-go-sdk v0.102.0
github.com/aziontech/azionapi-go-sdk v0.104.0
github.com/hashicorp/go-changelog v0.0.0-20230630083008-522d403eacf1
github.com/hashicorp/terraform-plugin-docs v0.16.0
github.com/hashicorp/terraform-plugin-framework v1.4.0
Expand Down Expand Up @@ -85,7 +85,7 @@ require (
golang.org/x/sync v0.1.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.6.0 // indirect
golang.org/x/tools v0.8.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.57.0 // indirect
Expand Down
Loading

0 comments on commit 216c3f0

Please sign in to comment.