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

[DRAFT] Plugin framework migration #32

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 92 additions & 100 deletions examples/main.tf
Original file line number Diff line number Diff line change
@@ -1,105 +1,97 @@
terraform {
required_providers {
vgs = {
source = "local.terraform.com/user/vgs"
version = "0.2.3"
}
}
}

provider "vgs" {
version = "~> 0.1"
environment = "sandbox"
organization = "ACrF5NY4vxzj8BvhU3q8btsN"
}

resource "vgs_route" "inbound_route" {
environment = "sandbox"
vault = "tntbcduzut5"
inline_config = <<EOF
id: 04b2e1b7-fb60-472f-a79f-af7e2353f122
type: rule_chain
attributes:
tags:
name: my-awesome-inbound-route
source: RouteContainer
destination_override_endpoint: 'https://echo.apps.verygood.systems'
host_endpoint: (.*)\.verygoodproxy\.io
id: 04b2e1b7-fb60-472f-a79f-af7e2353f122
ordinal: null
port: 80
protocol: http
source_endpoint: '*'
entries:
- classifiers: {}
config:
condition: AND
rules:
- expression:
field: PathInfo
operator: matches
type: string
values:
- /post
- expression:
field: ContentType
operator: equals
type: string
values:
- application/json
rules: null
id: 39f2f5db-06a0-461d-9387-dd9a7ab19035
id_selector: null
operation: REDACT
operations: null
phase: REQUEST
public_token_generator: UUID
targets:
- body
token_manager: PERSISTENT
transformer: JSON_PATH
transformer_config:
- $.account_number
transformer_config_map: null
EOF
resource "vgs_vault" "my_sandbox_vault" {
name = "My Testing Vault"
preferences = {
"interceptCORS" : "true"
}
}

resource "vgs_route" "outbound_route" {
environment = "sandbox"
vault = "tntbcduzut5"
inline_config = <<EOF
id: 37df6406-817f-4817-a72a-c675c50fb8ac
type: rule_chain
attributes:
tags:
name: my-awesome-outbound-route
source: RouteContainer
destination_override_endpoint: '*'
host_endpoint: echo\.apps\.verygood\.systems
id: 37df6406-817f-4817-a72a-c675c50fb8ac
ordinal: null
port: 80
protocol: http
source_endpoint: '*'
entries:
- classifiers: {}
config:
condition: AND
rules:
- expression:
field: PathInfo
operator: matches
type: string
values:
- /post
- expression:
field: ContentType
operator: equals
type: string
values:
- application/json
id: ea83a6fd-9d04-42b8-8ca0-d51b98380b2e
id_selector: null
operation: ENRICH
operations: null
phase: REQUEST
public_token_generator: UUID
targets:
- body
token_manager: PERSISTENT
transformer: JSON_PATH
transformer_config:
- $.account_number
transformer_config_map: null
type: null
EOF
}
resource "vgs_route" "test_route" {
vault = "tntbcduzut5"
protocol = "HTTP"
source_endpoint = "blab"
destination_override_endpoint = "vvvvv"
host_endpoint = "xxxx"
port = 80
filters = [
{
phase = "request"
alias_format = "UUID"
transformer = {
content_type = "csv"
config = {
column_indices : "[1, 2]"
}
}

targets = ["body"]
function = <<EOL
load('@stdlib/json', 'json')
def process(input, ctx):
body = json.decode(input.body())
as_str = json.encode(body['fields'])
token = vault.put(as_str)
body['fields'] = token
input.set_body(json.encode(body))
return input
EOL
conditions_inline = jsonencode({
condition = "AND"
rules = [
{
expression = {
field = "PathInfo"
operator = "matches"
type = "string"
values = [
"/post"
]
}
},
{
condition = "OR"
rules = [
{
expression = {
field = "ContentType"
operator = "equals"
type = "string"
values = [
"application/json"
]
}
},
{
expression = {
field = "ContentType"
operator = "equals"
type = "string"
values = [
"application/xml"
]
}
}
]
}
]
})
classifiers = {
"include" : ["pci-data"]
"tags" : ["my-filter"]
}
}
]
}
Loading