Terraform Usage & Examples
You would need to set up versions.tf with:
terraform {
required_providers {
edgeguardian = {
version = "~> 0.1.0"
source = "edgeguardian-artifacts.s3-us-west-2.amazonaws.com/edgeguardian/api"
}
}
}
provider "edgeguardian" {
nerve_token = "<redacted>"
}
Your main.tf would look something like this:
data "edgeguardian_user" "example_user" {
login = "example.user@yourco.com"
}
data "edgeguardian_user" "another_user" {
login = "another.user@yourco.com"
}
resource "edgeguardian_connector" "test_conn" {
unique_name = "test-connect2"
name = "Connector in ECS"
}
resource "edgeguardian_access" "example_user_access" {
user_list = [
# "user:*",
data.edgeguardian_user.example_user.as_tag_value,
data.edgeguardian_user.another_user.as_tag_value,
]
app_list = [
edgeguardian_app.example_app.as_tag_value
]
description = "Testing things out"
status = "ACTIVE"
}
resource "edgeguardian_app" "example_app" {
name = "example-app"
description = "Example testing app"
host = "example.yourco.com"
internal_host_pattern = "example.yourco.com"
# port = 80
# internal_port = 80
status = "ACTIVE"
connector_unique_name = edgeguardian_connector.test_conn.unique_name
}
To reference a workflow as a data source you'd need to use:
data "edgeguardian_workflow" "wf1" {
name = "Self Approval"
}
Which could then be referenced from a Policy like so:
resource "edgeguardian_policy" "policy1" {
name = "TF Testing"
action = "RUN_WORKFLOW"
description = "Testing out TF resource"
session_filter = {
include_any = [ { all: [ data.edgeguardian_user.example_user.as_tag_value ] } ]
exclude_any = [ { all: [ data.edgeguardian_user.another_user.as_tag_value ] } ]
}
app_filter = {
include_any = [ { all: [ edgeguardian_app.example_app.as_tag_value ] } ]
}
workflow_uuid = data.edgeguardian_workflow.wf1.uuid
}