Skip to content

Commit

Permalink
Update terraform provider
Browse files Browse the repository at this point in the history
  • Loading branch information
impart-security committed Jun 11, 2024
1 parent cc2c13c commit c1c6d7d
Show file tree
Hide file tree
Showing 40 changed files with 4,613 additions and 227 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [0.6.0] - 2024-06-11

### Added

- impart_list to manage lists
- impart_api_binding disabled attribute

## [0.5.0] - 2024-04-09

- Add impart_rule_script_dependencies resource
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.5.0
0.6.0
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ resource "impart_notification_template" "test" {
resource "impart_monitor" "test_event" {
name = "terraform_event_monitor"
description = "test event monitor"
notification_template_ids = [impart_notification_template.test.id]
notification_template_ids = [resource.impart_notification_template.test.id]
conditions = [
{
threshold = 1,
Expand All @@ -80,7 +80,7 @@ resource "impart_monitor" "test_event" {
resource "impart_monitor" "test_metric" {
name = "terraform_event_monitor"
description = "test event monitor"
notification_template_ids = [impart_notification_template.test.id]
notification_template_ids = [resource.impart_notification_template.test.id]
conditions = [
{
threshold = 1,
Expand Down
1 change: 1 addition & 0 deletions docs/resources/api_binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ resource "impart_api_binding" "example" {

### Optional

- `disabled` (Boolean) The disabled for this api binding.
- `forwarded_for` (List of String) The forwarded_for for this api binding.
- `forwarded_host` (List of String) The forwarded_host for this api binding.
- `forwarded_id` (List of String) The forwarded_id for this api binding.
Expand Down
41 changes: 41 additions & 0 deletions docs/resources/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "impart_list Resource - impart"
subcategory: ""
description: |-
Manage a list.
---

# impart_list (Resource)

Manage a list.



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

### Required

- `kind` (String) The list kind.
- `name` (String) The name for this list.

### Optional

- `items` (Attributes List) The list items. (see [below for nested schema](#nestedatt--items))
- `subkind` (String) The list subkind.

### Read-Only

- `id` (String) Identifier for this list.

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

Required:

- `value` (String) The list item value.

Optional:

- `expiration` (String) The list item expiration.
7 changes: 6 additions & 1 deletion docs/resources/log_binding.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,13 @@ Manage a log binding.
resource "impart_log_binding" "example" {
name = "log_binding_example"
pattern_type = "grok"
# Example patterns
# for api gateway log format: $context.requestTime "$context.httpMethod $context.path $context.protocol" $context.status $context.identity.sourceIp $context.requestId
# %%{HTTPDATE:timestamp} "(?:%%{WORD:http_method}|-) (?:%%{GREEDYDATA:request}|-) (?:HTTP/%%{NUMBER:httpversion}|-( )?)" (?:%%{NUMBER:response_code}|-)
# for aws loadbalancer access logs
# %%{TIMESTAMP_ISO8601:timestamp} %%{NOTSPACE:loadbalancer} %%{IP:client_ip}:%{NUMBER:client_port} (?:%{IP:backend_ip}:%{NUMBER:backend_port}|-) %%{NUMBER:request_processing_time} %%{NUMBER:backend_processing_time} %%{NUMBER:response_processing_time} (?:%{NUMBER:response_code}|-) (?:%{NUMBER:backend_status_code}|-) %%{NUMBER:received_bytes} %%{NUMBER:sent_bytes} "(?:%{WORD:http_method}|-) (?:%{GREEDYDATA:request}|-) (?:HTTP/%{NUMBER:http_version}|-( )?)" "%{DATA:user_agent}"( %%{NOTSPACE:ssl_cipher} %%{NOTSPACE:ssl_protocol})?
pattern = <<EOF
%%{HTTPDATE:timestamp} "(?:%%{WORD:http_method}|-) (?:%%{GREEDYDATA:request}|-) (?:HTTP/%%{NUMBER:httpversion}|-( )?)" (?:%%{NUMBER:response_code}|-)
<pattern>
EOF
logstream_id = "logstream_id"
spec_id = resource.impart_spec.example.id
Expand Down
11 changes: 10 additions & 1 deletion docs/resources/rule_script.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ resource "impart_rule_script" "example" {
source_file = "${path.module}/rule.js"
source_hash = "<sha256 hash for the source_file content>"
}
# Create a new rule script with content
resource "impart_rule_script" "example_content" {
name = "example"
disabled = false
description = "Rule description"
content = file("${path.module}/rule.js")
}
```

<!-- schema generated by tfplugindocs -->
Expand All @@ -30,11 +38,12 @@ resource "impart_rule_script" "example" {

- `disabled` (Boolean) Set true to disable the rule script.
- `name` (String) The name for this rule script.
- `source_file` (String) The rule source file.

### Optional

- `content` (String) The rule body content.
- `description` (String) The description for this rule script.
- `source_file` (String) The rule source file.
- `source_hash` (String) The rule source hash.

### Read-Only
Expand Down
20 changes: 20 additions & 0 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ resource "impart_spec" "example" {
# }
}

# Create a new list
resource "impart_list" "example" {
name = "list_example"
kind = "string"
}

# Create a new rule script
resource "impart_rule_script" "example" {
name = "example"
disabled = false
description = "Rule description"
content = <<EOF
import { List } from "asruleslib";
// Reference the list
let list = new List("${resource.impart_list.example.id}");
...
EOF
}

# Create a new notification template
resource "impart_notification_template" "test" {
name = "terraform_notification_template"
Expand Down
13 changes: 13 additions & 0 deletions examples/resources/impart_list/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Create a new list
resource "impart_list" "example" {
name = "list_example"
kind = "string"
items = [
{
value = "item1",
},
{
value = "item2",
}
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Create a new notification template
resource "impart_notification_template" "example" {
name = "notification_template_example"
connector_id = resource.impart_connector.example_connector.id
connector_id = "<example_connector.id>"
payload = "This is a test message payload"
subject = "Test subject"
destination = ["test-destination-id"]
Expand Down
8 changes: 8 additions & 0 deletions examples/resources/impart_rule_script/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ resource "impart_rule_script" "example" {
source_file = "${path.module}/rule.js"
source_hash = "<sha256 hash for the source_file content>"
}

# Create a new rule script with content
resource "impart_rule_script" "example_content" {
name = "example"
disabled = false
description = "Rule description"
content = file("${path.module}/rule.js")
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "impart_rule_script_dependencies" "example" {
dependencies = [
{
"rule_script_id" : resource.impart_rule_script.example_1.id,
"depends_on_rule_script_ids" : [resource.impart_rule_script.example_2.id]
"rule_script_id" : "<example_1.id>",
"depends_on_rule_script_ids" : ["<example_2.id>"]
}
]
}
75 changes: 41 additions & 34 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,28 @@ module github.com/impart-security/terraform-provider-impart
go 1.22

require (
github.com/hashicorp/terraform-plugin-docs v0.18.0
github.com/hashicorp/terraform-plugin-framework v1.7.0
github.com/hashicorp/terraform-plugin-go v0.22.1
github.com/hashicorp/terraform-plugin-docs v0.19.4
github.com/hashicorp/terraform-plugin-framework v1.9.0
github.com/hashicorp/terraform-plugin-go v0.23.0
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0
golang.org/x/oauth2 v0.19.0
github.com/hashicorp/terraform-plugin-testing v1.8.0
golang.org/x/oauth2 v0.20.0
)

require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.0 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.0 // indirect
github.com/ProtonMail/go-crypto v1.1.0-alpha.2-proton // indirect
github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/cloudflare/circl v1.3.7 // indirect
github.com/fatih/color v1.16.0 // indirect
github.com/bmatcuk/doublestar/v4 v4.6.1 // indirect
github.com/cloudflare/circl v1.3.8 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/go-test/deep v1.0.4 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/go-cmp v0.6.0 // indirect
Expand All @@ -32,49 +34,54 @@ require (
github.com/hashicorp/go-checkpoint v0.5.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.6.2 // indirect
github.com/hashicorp/go-hclog v1.6.3 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-plugin v1.6.1 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/hashicorp/hc-install v0.6.3 // indirect
github.com/hashicorp/hcl/v2 v2.19.1 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/hc-install v0.7.0 // indirect
github.com/hashicorp/hcl/v2 v2.20.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.20.0 // indirect
github.com/hashicorp/terraform-json v0.21.0 // indirect
github.com/hashicorp/terraform-exec v0.21.0 // indirect
github.com/hashicorp/terraform-json v0.22.1 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 // indirect
github.com/hashicorp/terraform-registry-address v0.2.3 // indirect
github.com/hashicorp/terraform-svchost v0.1.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/huandu/xstrings v1.3.3 // indirect
github.com/imdario/mergo v0.3.15 // indirect
github.com/huandu/xstrings v1.5.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/posener/complete v1.2.3 // indirect
github.com/russross/blackfriday v1.6.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/vmihailenco/msgpack v4.0.4+incompatible // indirect
github.com/vmihailenco/msgpack/v5 v5.4.1 // indirect
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect
github.com/yuin/goldmark v1.6.0 // indirect
github.com/yuin/goldmark v1.7.1 // indirect
github.com/yuin/goldmark-meta v1.1.0 // indirect
github.com/zclconf/go-cty v1.14.2 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
github.com/zclconf/go-cty v1.14.4 // indirect
go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240325203815-454cdb8f5daa // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.3.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit c1c6d7d

Please sign in to comment.