diff --git a/README.md b/README.md
index 191a9d7..5b44ce9 100644
--- a/README.md
+++ b/README.md
@@ -12,52 +12,40 @@ the arguments should include the -a|--action flag which calls the function (acti
#The following example validates there are no duplicate environments under two different data layers:
required_providers {
toluna = {
- source = "toluna-terraform/toluna"
+ source = "toluna-terraform/toluna-v2"
}
}
}
-data "toluna_validate_configuration" "app_json" {
- dynamic "rule_set" {
- for_each = local.app_config
- content {
- key_name = rule_set.value["key_name"]
- rule = rule_set.value["rule"]
- value = rule_set.value["value"]
- }
- }
- json_config = data.consul_keys.appjson.var
-}
+data "toluna_environment_config" "app_json" {
+ address = "consul-cluster-test.consul.1234546-abcd-efgh-ijkl-12345678.aws.hashicorp.cloud"
+ scheme = "https"
+ path = "terraform/app-name/app-env.json"
+ validation_rules = "terraform/validations/app-config.json"
+}
```
## Toggles
#### Validate arguments:
-```yaml
-arguments = command line arguments to pass to the validation script I.E. -a funcation name to run -f some file to validate
-```
## Requirements
-| Name | Version |
-|------|---------|
-| [terraform](#requirement\_terraform) | >= 1.0.0 |
-
-
## Providers
| Name | Version |
|------|---------|
-| [assert](https://github.com/bwoznicki/terraform-provider-assert) | >= 0.0.1 |
+| [assert](https://github.com/toluna-terraform/terraform-provider-toluna-v2) | >= 1.0.2 |
## Modules
+## Resources
+
+## DataSource
| Name | Source | Version |
|------|--------|---------|
-| [validate](#module\validate) | ../../ | |
-
-## Resources
+| [toluna_environment_config](#data\toluna_environment_config) | ../../ | |
No Resources.
diff --git a/docs/data-sources/toluna_environment_config.md b/docs/data-sources/toluna_environment_config.md
new file mode 100644
index 0000000..497778b
--- /dev/null
+++ b/docs/data-sources/toluna_environment_config.md
@@ -0,0 +1,30 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "toluna_environment_config Data Source - terraform-provider-toluna-v2"
+subcategory: ""
+description: |-
+
+---
+
+# toluna_environment_config (Data Source)
+
+
+
+
+
+
+## Schema
+
+### Required
+
+- `address` (String)
+- `path` (String)
+- `scheme` (String)
+- `validation_rules` (String)
+
+### Read-Only
+
+- `configuration` (String)
+- `id` (Number) The ID of this resource.
+
+
diff --git a/docs/index.md b/docs/index.md
index f27be0b..8115587 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -1,92 +1,20 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "toluna Provider"
+page_title: "toluna-v2 Provider"
subcategory: ""
description: |-
---
-# toluna Provider
-The Toluna provider provides resources to allow custom action on terraform resources
+# toluna-v2 Provider
-## Example Usage
-```terraform
-terraform {
- required_providers {
- toluna = {
- source = "toluna-terraform/toluna"
- version = ">=0.0.9"
- }
- }
-}
-provider "aws" {
- region = "us-east-1"
- profile = "my-profile"
-}
-provider "toluna" {
-
-}
-
-
-resource "toluna_invoke_lambda" "example" {
- region = "us-east-1"
- aws_profile = "my-profile"
- function_name = "my_lambda"
- payload = jsonencode({"name": "example pay load"})
-}
-
-resource "toluna_start_codebuild" "example" {
- region = "us-east-1"
- aws_profile = "my-profile"
- project_name = "my_project"
- environment_variables {
- name = "my-variable"
- value = "FOO"
- type = "PLAINTEXT"
- }
- environment_variables {
- name = "my-secret-variable"
- value = "BAR"
- type = "PARAMETER_STORE"
- }
- environment_variables {
- name = "my-other-secret-variable"
- value = "BAR"
- type = "SECRETS_MANAGER"
- }
-}
+
+## Schema
-data "toluna_validate_configuration" "example" {
- rule_set {
- key_name = "key"
- rule ="unique"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="odd"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule =">"
- value = "6"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="<"
- value = "21"
- }
- rule_set {
- key_name = "key"
- rule ="~="
- value = "example"
- }
- json_config = data.consul_keys.appjson.var
-}
-```
+### Optional
+- `strict_module_validation` (Boolean) Defaults to `false`.
diff --git a/docs/resources/invoke_lambda.md b/docs/resources/invoke_lambda.md
deleted file mode 100644
index 14fae76..0000000
--- a/docs/resources/invoke_lambda.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "toluna_invoke_lambda Resource - terraform-provider-toluna"
-subcategory: ""
-description: |-
-
----
-
-# toluna_invoke_lambda (Resource)
-
-
-
-
-
-
-## Schema
-
-### Required
-
-- `function_name` (String)
-- `payload` (String)
-- `region` (String)
-
-### Optional
-
-- `aws_profile` (String)
-- `id` (String) The ID of this resource.
-
-
-## Example Usage
-
-```terraform
-
-terraform {
- required_providers {
- toluna = {
- source = "toluna-terraform/toluna"
- version = ">=0.0.9"
- }
- }
-}
-
-provider "aws" {
- region = "us-east-1"
- profile = "my-profile"
-}
-
-provider "toluna" {
-
-}
-
-resource "toluna_invoke_lambda" "example" {
- region = "us-east-1"
- aws_profile = "my-profile"
- function_name = "my_lambda"
- payload = jsonencode({"name": "example pay load"})
-}
-```
\ No newline at end of file
diff --git a/docs/resources/start_codebuild.md b/docs/resources/start_codebuild.md
deleted file mode 100644
index 9e156aa..0000000
--- a/docs/resources/start_codebuild.md
+++ /dev/null
@@ -1,72 +0,0 @@
----
-# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "toluna_start_codebuild Resource - terraform-provider-toluna"
-subcategory: ""
-description: |-
-
----
-
-# toluna_start_codebuild (Resource)
-
-
-
-
-
-
-## Schema
-
-### Required
-
-- `project_name` (String)
-- `region` (String)
-
-### Optional
-
-- `aws_profile` (String)
-- `id` (String) The ID of this resource.
-- `payload` (String)
-
-
-## Example Usage
-
-```terraform
-
-terraform {
- required_providers {
- toluna = {
- source = "toluna-terraform/toluna"
- version = ">=0.0.9"
- }
- }
-}
-
-provider "aws" {
- region = "us-east-1"
- profile = "my-profile"
-}
-
-provider "toluna" {
-
-}
-
-resource "toluna_start_codebuild" "example" {
- region = "us-east-1"
- aws_profile = "my-profile"
- project_name = "my_project"
- environment_variables {
- name = "my-variable"
- value = "FOO"
- type = "PLAINTEXT"
- }
- environment_variables {
- name = "my-secret-variable"
- value = "BAR"
- type = "PARAMETER_STORE"
- }
- environment_variables {
- name = "my-other-secret-variable"
- value = "BAR"
- type = "SECRETS_MANAGER"
- }
-}
-```
\ No newline at end of file
diff --git a/docs/resources/toluna_invoke_lambda.md b/docs/resources/toluna_invoke_lambda.md
new file mode 100644
index 0000000..2cba2e5
--- /dev/null
+++ b/docs/resources/toluna_invoke_lambda.md
@@ -0,0 +1,29 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "toluna_invoke_lambda Resource - terraform-provider-toluna-v2"
+subcategory: ""
+description: |-
+
+---
+
+# toluna_invoke_lambda (Resource)
+
+
+
+
+
+
+## Schema
+
+### Required
+
+- `function_name` (String)
+- `payload` (String)
+- `region` (String)
+
+### Optional
+
+- `aws_profile` (String)
+- `id` (String) The ID of this resource.
+
+
diff --git a/docs/resources/toluna_start_codebuild.md b/docs/resources/toluna_start_codebuild.md
new file mode 100644
index 0000000..8f48578
--- /dev/null
+++ b/docs/resources/toluna_start_codebuild.md
@@ -0,0 +1,38 @@
+---
+# generated by https://github.com/hashicorp/terraform-plugin-docs
+page_title: "toluna_start_codebuild Resource - terraform-provider-toluna-v2"
+subcategory: ""
+description: |-
+
+---
+
+# toluna_start_codebuild (Resource)
+
+
+
+
+
+
+## Schema
+
+### Required
+
+- `project_name` (String)
+- `region` (String)
+
+### Optional
+
+- `aws_profile` (String)
+- `environment_variables` (Block Set) (see [below for nested schema](#nestedblock--environment_variables))
+- `id` (String) The ID of this resource.
+
+
+### Nested Schema for `environment_variables`
+
+Required:
+
+- `name` (String)
+- `type` (String)
+- `value` (String)
+
+
diff --git a/docs/resources/validate_configuration.md b/docs/resources/validate_configuration.md
deleted file mode 100644
index a08961d..0000000
--- a/docs/resources/validate_configuration.md
+++ /dev/null
@@ -1,80 +0,0 @@
----
-# generated by https://github.com/hashicorp/terraform-plugin-docs
-page_title: "toluna_validate_configuration Data Source - terraform-provider-toluna"
-subcategory: ""
-description: |-
-
----
-
-# toluna_invoke_lambda (Resource)
-
-
-
-
-
-
-## Schema
-
-### Required
-
-- `rule_set` (Block)
- - key_name (String)
- - rule (String)
- - value (String)
-- `json_config` (Map)
-
-
-### Optional
-
-
-## Example Usage
-
-```terraform
-
-terraform {
- required_providers {
- toluna = {
- source = "toluna-terraform/toluna"
- version = ">=0.0.9"
- }
- }
-}
-
-provider "aws" {
- region = "us-east-1"
- profile = "my-profile"
-}
-
-provider "toluna" {
-
-}
-
-data "toluna_validate_configuration" "example" {
- rule_set {
- key_name = "key"
- rule ="unique"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="odd"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule =">"
- value = "6"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="<"
- value = "21"
- }
- rule_set {
- key_name = "key"
- rule ="~="
- value = "example"
- }
- json_config = data.consul_keys.appjson.var
-}
-```
\ No newline at end of file
diff --git a/examples/basic/main.tf b/examples/basic/main.tf
index 147453a..6fda485 100644
--- a/examples/basic/main.tf
+++ b/examples/basic/main.tf
@@ -46,31 +46,13 @@ resource "toluna_start_codebuild" "example" {
}
}
-data "toluna_validate_configuration" "example" {
- rule_set {
- key_name = "key"
- rule ="unique"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="odd"
- value = "nil"
- }
- rule_set {
- key_name = "$..env_index"
- rule =">"
- value = "6"
- }
- rule_set {
- key_name = "$..env_index"
- rule ="<"
- value = "21"
- }
- rule_set {
- key_name = "key"
- rule ="~="
- value = "example"
- }
- json_config = data.consul_keys.appjson.var
-}
\ No newline at end of file
+data "toluna_environment_config" "app_json" {
+ address = "consul-cluster-test.consul.1234546-abcd-efgh-ijkl-12345678.aws.hashicorp.cloud"
+ scheme = "https"
+ path = "terraform/app-name/app-env.json"
+ validation_rules = "terraform/validations/app-config.json"
+}
+
+locals {
+ env_vars = jsondecode("${data.toluna_environment_config.app_json.configuration}")[local.env_name]
+}
\ No newline at end of file
diff --git a/examples/terraform-custom-validations/README.md b/examples/terraform-custom-validations/README.md
deleted file mode 100644
index 571de6e..0000000
--- a/examples/terraform-custom-validations/README.md
+++ /dev/null
@@ -1,68 +0,0 @@
-Adding custom validations to Terraform [Terraform module](https://registry.terraform.io/modules/toluna-terraform/validations/latest)
-
-### Description
-This module supports adding custom validations not supported by out of the box Terraform validations upon plan.
-This is achieved by running a bash script containing custom functions , that can be call wit h different arguments,
-the arguments should include the -a|--action flag which calls the function (action = function name) and any other flags required by the specific function.
-
-
-## Usage
-
-```hcl
-#The following example validates there are no duplicate environments under two different data layers:
-module "validate" {
- source = "toluna-terraform/validations/custom"
- version = "~>0.0.1" // Change to the required version.
- arguments = "-a validate_duplicate_env -f ${path.module}/some_json_file.json"
-}
-#The following example validates you cannot enter a negative value as an index number or an index higher then maximum possible ciders in a json file:
-module "validate" {
- source = "toluna-terraform/validations/custom"
- version = "~>0.0.1" // Change to the required version.
- arguments = "-a validate_min_max_env -f ${path.module}/some_json_file.json -m 15"
-}
-#The following example validates you cannot enter a duplicate index number in a json file:
-module "validate" {
- source = "toluna-terraform/validations/custom"
- version = "~>0.0.1" // Change to the required version.
- arguments = "-a validate_duplicate_index -f ${path.module}/some_json_file.json"
-}
-```
-
-## Toggles
-#### Validate arguments:
-```yaml
-arguments = command line arguments to pass to the validation script I.E. -a funcation name to run -f some file to validate
-```
-
-## Requirements
-
-| Name | Version |
-|------|---------|
-| [terraform](#requirement\_terraform) | >= 1.0.0 |
-
-
-## Providers
-
-| Name | Version |
-|------|---------|
-| [assert](https://github.com/bwoznicki/terraform-provider-assert) | >= 0.0.1 |
-
-
-## Modules
-
-| Name | Source | Version |
-|------|--------|---------|
-| [validate](#module\validate) | ../../ | |
-
-## Resources
-
-No Resources.
-
-## Inputs
-
-No inputs.
-
-## Outputs
-
-No outputs.
diff --git a/examples/terraform-custom-validations/main.tf b/examples/terraform-custom-validations/main.tf
deleted file mode 100644
index c038db8..0000000
--- a/examples/terraform-custom-validations/main.tf
+++ /dev/null
@@ -1,15 +0,0 @@
-module "validate_max_index" {
- source = "../../"
- arguments = "-a validate_min_max_env -f ${path.module}/myJsonFile.json -m 15"
-}
-
-module "validate_duplicate_index" {
- source = "../../"
- arguments = "-a validate_duplicate_index -f ${path.module}/myJsonFile.json"
-}
-
-module "validate_duplicate_env" {
- source = "../../"
- arguments = "-a validate_duplicate_env -f ${path.module}/myJsonFile.json"
-}
-
diff --git a/go.mod b/go.mod
index 001ddda..3370de8 100644
--- a/go.mod
+++ b/go.mod
@@ -8,35 +8,49 @@ require (
github.com/hashicorp/terraform-plugin-sdk/v2 v2.24.0
)
+require (
+ github.com/armon/go-metrics v0.3.10 // indirect
+ github.com/go-test/deep v1.0.7 // indirect
+ github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
+ github.com/hashicorp/go-immutable-radix v1.3.0 // indirect
+ github.com/hashicorp/go-rootcerts v1.0.2 // indirect
+ github.com/hashicorp/golang-lru v0.5.4 // indirect
+ github.com/hashicorp/hcl v1.0.0 // indirect
+ github.com/hashicorp/serf v0.9.7 // indirect
+ github.com/kr/pretty v0.3.0 // indirect
+ github.com/mitchellh/go-homedir v1.1.0 // indirect
+ github.com/sergi/go-diff v1.2.0 // indirect
+)
+
require (
github.com/PaesslerAG/gval v1.0.0 // indirect
- github.com/agext/levenshtein v1.2.2 // indirect
+ github.com/agext/levenshtein v1.2.3 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/fatih/color v1.13.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
- github.com/hashicorp/errwrap v1.0.0 // indirect
+ github.com/hashicorp/consul/api v1.15.3
+ github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect
github.com/hashicorp/go-hclog v1.2.1 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.4 // indirect
github.com/hashicorp/go-uuid v1.0.3 // indirect
- github.com/hashicorp/go-version v1.6.0 // indirect
+ github.com/hashicorp/go-version v1.6.0
github.com/hashicorp/hcl/v2 v2.14.1 // indirect
github.com/hashicorp/logutils v1.0.0 // indirect
+ github.com/hashicorp/terraform-config-inspect v0.0.0-20221020162138-81db043ad408
github.com/hashicorp/terraform-plugin-go v0.14.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.7.0 // indirect
github.com/hashicorp/terraform-registry-address v0.0.0-20220623143253-7d51757b572c // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
- github.com/kr/pretty v0.2.1 // indirect
- github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.12 // indirect
github.com/mattn/go-isatty v0.0.14 // 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.0 // 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.0.0 // indirect
@@ -44,8 +58,8 @@ require (
github.com/vmihailenco/msgpack/v4 v4.3.12 // indirect
github.com/vmihailenco/tagparser v0.1.1 // indirect
github.com/zclconf/go-cty v1.11.0 // indirect
- golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
- golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
+ golang.org/x/net v0.0.0-20220722155237-a158d28d115b // indirect
+ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d // indirect
diff --git a/go.sum b/go.sum
index 790b42a..ecbe5e7 100644
--- a/go.sum
+++ b/go.sum
@@ -1,23 +1,40 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/PaesslerAG/gval v1.0.0 h1:GEKnRwkWDdf9dOmKcNrar9EA1bz1z9DqPIO1+iLzhd8=
github.com/PaesslerAG/gval v1.0.0/go.mod h1:y/nm5yEyTeX6av0OfKJNp9rBNj2XrGhAf5+v24IBN1I=
github.com/PaesslerAG/jsonpath v0.1.0/go.mod h1:4BzmtoM/PI8fPO4aQGIusjGxGir2BzcV0grWtFzq1Y8=
github.com/PaesslerAG/jsonpath v0.1.1 h1:c1/AToHQMVsduPAa4Vh6xp2U0evy4t8SWp8imEsylIk=
github.com/PaesslerAG/jsonpath v0.1.1/go.mod h1:lVboNxFGal/VwW6d9JzIy56bUsYAP6tH/x80vjnCseY=
-github.com/agext/levenshtein v1.2.2 h1:0S/Yg6LYmFJ5stwQeRp6EeOcCbj7xiqQSdNelsXvaqE=
-github.com/agext/levenshtein v1.2.2/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/agext/levenshtein v1.2.3 h1:YB2fHEn0UJagG8T1rrWknE3ZQzWM06O8AMAatNn7lmo=
+github.com/agext/levenshtein v1.2.3/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558=
+github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
+github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/apparentlymart/go-dump v0.0.0-20190214190832-042adf3cf4a0 h1:MzVXffFUye+ZcSR6opIgz9Co7WcDx6ZcY+RjfFHoA0I=
github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk=
github.com/apparentlymart/go-textseg/v12 v12.0.0/go.mod h1:S/4uRK2UtaQttw1GenVJEynmyUenKwP++x/+DdGV/Ec=
github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw=
github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo=
+github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
+github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
+github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo=
+github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
+github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
+github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/aws/aws-sdk-go v1.44.126 h1:7HQJw2DNiwpxqMe2H7odGNT2rhO4SRrUe5/8dYXl0Jk=
github.com/aws/aws-sdk-go v1.44.126/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
+github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
+github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
+github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
+github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
+github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag=
+github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
@@ -35,10 +52,19 @@ github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1m
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
+github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
-github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68=
+github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
+github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
+github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
+github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M=
+github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8=
+github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -58,6 +84,9 @@ github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
+github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
+github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo=
+github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -65,31 +94,74 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
-github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
+github.com/hashicorp/consul/api v1.15.3 h1:WYONYL2rxTXtlekAqblR2SCdJsizMDIj/uXb5wNy9zU=
+github.com/hashicorp/consul/api v1.15.3/go.mod h1:/g/qgcoBcEXALCNZgRRisyTW0nY86++L0KbeAMXYCeY=
+github.com/hashicorp/consul/sdk v0.11.0 h1:HRzj8YSCln2yGgCumN5CL8lYlD3gBurnervJRJAZyC4=
+github.com/hashicorp/consul/sdk v0.11.0/go.mod h1:yPkX5Q6CsxTFMjQQDJwzeNmUUF5NUGGbrDsv9wTb8cw=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
+github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
+github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
+github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
+github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI=
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs=
+github.com/hashicorp/go-hclog v0.12.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
+github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-hclog v1.2.1 h1:YQsLlGDJgwhXFpucSPyVbCBviQtjlHv3jLTlp8YmtEw=
github.com/hashicorp/go-hclog v1.2.1/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M=
+github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-immutable-radix v1.3.0 h1:8exGP7ego3OmkfksihtSouGMZ+hQrhxx+FVELeXpVPE=
+github.com/hashicorp/go-immutable-radix v1.3.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
+github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
+github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
+github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
+github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/hashicorp/go-plugin v1.4.4 h1:NVdrSdFRt3SkZtNckJ6tog7gbpRrcbOjQi/rgF7JYWQ=
github.com/hashicorp/go-plugin v1.4.4/go.mod h1:viDMjcLJuDui6pXb8U4HVfb8AamCWhHGUjr2IrTF67s=
+github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs=
+github.com/hashicorp/go-rootcerts v1.0.2 h1:jzhAVGtqPKbwpyCPELlgNWhE1znq+qwJtW5Oi2viEzc=
+github.com/hashicorp/go-rootcerts v1.0.2/go.mod h1:pqUvnprVnM5bf7AOirdbb01K4ccR319Vf4pU3K5EGc8=
+github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU=
+github.com/hashicorp/go-sockaddr v1.0.2 h1:ztczhD1jLxIRjVejw8gFomI1BQZOe2WoVOu0SyteCQc=
+github.com/hashicorp/go-sockaddr v1.0.2/go.mod h1:rB4wwRAUzs07qva3c5SdrY/NEtAUjGlgmH/UkBUC97A=
+github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4=
+github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
+github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8=
github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro=
github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek=
github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA=
+github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
+github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
+github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
+github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/hcl/v2 v2.14.1 h1:x0BpjfZ+CYdbiz+8yZTQ+gdLO7IXvOut7Da+XJayx34=
github.com/hashicorp/hcl/v2 v2.14.1/go.mod h1:e4z5nxYlWNPdDSNYX+ph14EvWYMFm3eP0zIUqPc2jr0=
github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y=
github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64=
+github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc=
+github.com/hashicorp/memberlist v0.3.0/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
+github.com/hashicorp/memberlist v0.3.1 h1:MXgUXLqva1QvpVEDQW1IQLG0wivQAtmFlHRQ+1vWZfM=
+github.com/hashicorp/memberlist v0.3.1/go.mod h1:MS2lj3INKhZjWNqd3N0m3J+Jxf3DAOnAH9VT3Sh9MUE=
+github.com/hashicorp/serf v0.9.7 h1:hkdgbqizGQHuU5IPqYM1JdSMV8nKfpuOnZYXssk9muY=
+github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
+github.com/hashicorp/terraform-config-inspect v0.0.0-20221020162138-81db043ad408 h1:dol/gV6vq/QBI1lGTxUEUGr8ixcs4SU79lgCoRMg3pU=
+github.com/hashicorp/terraform-config-inspect v0.0.0-20221020162138-81db043ad408/go.mod h1:EAaqp5h9PsUNr6NtgLj31w+ElcCEL+1Svw1Jw+MTVKU=
github.com/hashicorp/terraform-plugin-go v0.14.0 h1:ttnSlS8bz3ZPYbMb84DpcPhY4F5DsQtcAS7cHo8uvP4=
github.com/hashicorp/terraform-plugin-go v0.14.0/go.mod h1:2nNCBeRLaenyQEi78xrGrs9hMbulveqG/zDMQSvVJTE=
github.com/hashicorp/terraform-plugin-log v0.7.0 h1:SDxJUyT8TwN4l5b5/VkiTIaQgY6R+Y2BQ0sRZftGKQs=
@@ -107,44 +179,109 @@ github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9Y
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGwWFoC7ycTf1rcQZHOlsJ6N8=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
+github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
+github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
-github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
+github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
+github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
+github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k=
github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
+github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40=
github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
+github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
+github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
+github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
+github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
+github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
+github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso=
+github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY=
+github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI=
+github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc=
+github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
+github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
+github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU=
github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8=
-github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4=
github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo=
+github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0=
+github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0=
+github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
+github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
+github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
+github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nsf/jsondiff v0.0.0-20200515183724-f29ed568f4ce h1:RPclfga2SEJmgMmz2k+Mg7cowZ8yv4Trqw9UsJby758=
github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
+github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=
+github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
+github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
+github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
+github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s=
+github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
+github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
+github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
+github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
+github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
+github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
+github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
+github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
+github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I=
+github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc=
+github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
+github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
+github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/objx v0.1.1 h1:2vfRuCMp5sSVIDSqO8oNnWJq7mPa6KVP3iPIwFBuy8A=
+github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
+github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
+github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s=
github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals=
+github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM=
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
github.com/vmihailenco/msgpack v4.0.4+incompatible h1:dSLoQfGFAo3F6OoNhwUmLwVgaUXK79GlxNBwueZn0xI=
github.com/vmihailenco/msgpack v4.0.4+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
@@ -156,7 +293,9 @@ github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLE
github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0=
github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
+golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -165,18 +304,26 @@ golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHl
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
+golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
-golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
+golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8=
+golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b h1:PxfKdU9lEEDYjdIzOtC4qFWgkU2rGHdKlKowJSMN9h0=
+golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -184,26 +331,44 @@ golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
+golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f h1:v4INt8xihDGvnrfjMDVXGxw9wrfxYyCjk0KbXjhR55s=
+golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -211,6 +376,8 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
@@ -247,12 +414,18 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
+gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
diff --git a/internal/provider/data_source_environment_config.go b/internal/provider/data_source_environment_config.go
new file mode 100644
index 0000000..a233ce5
--- /dev/null
+++ b/internal/provider/data_source_environment_config.go
@@ -0,0 +1,307 @@
+package toluna
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "regexp"
+ "strconv"
+ "strings"
+ "time"
+
+ "github.com/PaesslerAG/jsonpath"
+ "github.com/hashicorp/consul/api"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
+)
+
+func dataSourceEnvironmentConfig() *schema.Resource {
+ return &schema.Resource{
+ ReadContext: dataSourceEnvironmentConfigRead,
+ Schema: map[string]*schema.Schema{
+ "id": &schema.Schema{
+ Type: schema.TypeInt,
+ Computed: true,
+ },
+ "configuration": &schema.Schema{
+ Type: schema.TypeString,
+ Computed: true,
+ },
+ "address": {
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "scheme": {
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "path": {
+ Type: schema.TypeString,
+ Required: true,
+ },
+ "validation_rules": {
+ Type: schema.TypeString,
+ Required: true,
+ },
+ },
+ }
+}
+
+func dataSourceEnvironmentConfigRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
+ var diags diag.Diagnostics
+ client, err := api.NewClient(&api.Config{
+ Address: d.Get("address").(string),
+ Scheme: d.Get("scheme").(string),
+ })
+ if err != nil {
+ return diag.Errorf("Could not connect to Consul: %s", err)
+ }
+ kv := client.KV()
+
+ config_result, _, err := kv.Get(d.Get("path").(string), nil)
+ if err != nil {
+ return diag.Errorf("Could not find configuration: %s", err)
+ }
+ config := string(config_result.Value)
+ rules_result, _, err := kv.Get(d.Get("validation_rules").(string), nil)
+ if err != nil {
+ return diag.Errorf("Could not find rule set: %s", err)
+ }
+ rules_list := string(rules_result.Value)
+
+ var rules map[string]interface{}
+ var configuration map[string]interface{}
+ json.Unmarshal([]byte(rules_list), &rules)
+ json.Unmarshal([]byte(config), &configuration)
+ for rule_key, rule_value := range rules {
+ fmt.Printf("%v", rule_key)
+ rules_map := rule_value.(map[string]interface{})
+ key_name := rules_map["key_name"].(string)
+ rule := rules_map["rule"].(string)
+ value := rules_map["value"].(string)
+ if key_name == "" || rule == "" || value == "" {
+ return diag.Errorf("missing param: %s", rule_value)
+ }
+
+ value_arr := getValue(configuration, key_name)
+
+ if len(value_arr) == 0 {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Key not found",
+ Detail: fmt.Sprintf("key: %s not found , %s", key_name, configuration),
+ })
+ }
+ for v := range value_arr {
+ switch {
+ case rule == "==":
+ if value_arr[v] != value {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s is not equal to: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == "!=":
+ if value_arr[v] == value {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should not be equal to: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == ">":
+ intVar, err := strconv.Atoi(value_arr[v])
+ intValue, err := strconv.Atoi(value)
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if intVar <= intValue {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should be greater then: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == "<":
+ intVar, err := strconv.Atoi(value_arr[v])
+ intValue, err := strconv.Atoi(value)
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if intVar >= intValue {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should be lower then: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == ">=":
+ intVar, err := strconv.Atoi(value_arr[v])
+ intValue, err := strconv.Atoi(value)
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if intVar < intValue {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should be greater then or equal to: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == "<=":
+ intVar, err := strconv.Atoi(value_arr[v])
+ intValue, err := strconv.Atoi(value)
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if intVar > intValue {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should be lower then or equal to: %s", key_name, value_arr, value),
+ })
+ }
+ case rule == "not_contain":
+ if strings.Contains(value_arr[v], value) {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s in %s should not contain: %s", value_arr[v], value_arr, value),
+ })
+ }
+ case rule == "odd":
+ intVar, err := strconv.Atoi(value_arr[v])
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if Even(intVar) {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s with value %s is an even number but should be odd", key_name, value_arr[v]),
+ })
+ }
+ case rule == "even":
+ intVar, err := strconv.Atoi(value_arr[v])
+ if err != nil {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Invalid Configuration format",
+ Detail: fmt.Sprintf("Cannot compare string with number %s", value_arr[v]),
+ })
+ }
+ if Odd(intVar) {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: "Configuration key mismatch",
+ Detail: fmt.Sprintf("Key %s with value %s is an odd number but should be even", key_name, value_arr[v]),
+ })
+ }
+ case rule == "unique":
+ if key_name == "key" {
+ count := 0
+ key_regexp := fmt.Sprintf(`"%v".*:`, value_arr[v])
+ var re = regexp.MustCompile(key_regexp)
+ for i, match := range re.FindAllString(config, -1) {
+ fmt.Println(match, "found at index", i)
+ count++
+ }
+ if count > 1 {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: fmt.Sprintf("Key name %s is used more then once.", value_arr[v]),
+ Detail: fmt.Sprintf("%s", config),
+ })
+ }
+ }
+ if checkDup(value_arr, value_arr[v]) {
+ diags = append(diags, diag.Diagnostic{
+ Severity: diag.Error,
+ Summary: fmt.Sprintf("Key %s has duplicate value %s.", key_name, value_arr[v]),
+ Detail: fmt.Sprintf("%s", config),
+ })
+ }
+ }
+ }
+ }
+
+ if diags != nil {
+ return diags
+ }
+ if err := d.Set("configuration", config); err != nil {
+ return diag.Errorf("Could retrieve configuration: %s", err)
+ }
+ d.SetId(strconv.FormatInt(time.Now().Unix(), 10))
+ return diags
+}
+
+func Even(number int) bool {
+ return number%2 == 0
+}
+
+func Odd(number int) bool {
+ return !Even(number)
+}
+
+func checkDup(heystack []string, needle string) bool {
+ count := 0
+ var i int
+ for i = 0; i < len(heystack); i++ {
+ if heystack[i] == needle {
+ count++
+ }
+ }
+ if count == 1 {
+ return false
+ } else {
+ return true
+ }
+
+}
+
+func getValue(config map[string]interface{}, key_name string) []string {
+ if key_name == "key" {
+ var s []string
+ for k, _ := range config {
+ if k != "" {
+ s = append(s, k)
+ }
+ }
+ return s
+ } else {
+ values, err := jsonpath.Get(key_name, config)
+ if err != nil {
+ fmt.Println(err)
+ return nil
+ }
+ var k []string
+ for _, value := range values.([]interface{}) {
+ val := strings.ReplaceAll(fmt.Sprintln(value), "\n", "")
+ if val != "" {
+ k = append(k, val)
+ }
+ }
+ return k
+ }
+}
diff --git a/internal/provider/data_source_validate_configuration.go b/internal/provider/data_source_validate_configuration.go
deleted file mode 100644
index 03eeda6..0000000
--- a/internal/provider/data_source_validate_configuration.go
+++ /dev/null
@@ -1,217 +0,0 @@
-package toluna
-
-import (
- "context"
- "encoding/json"
- "fmt"
- "regexp"
- "strconv"
- "strings"
-
- "github.com/PaesslerAG/jsonpath"
- "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
- "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
-)
-
-func dataSourceValidateConfiguration() *schema.Resource {
- return &schema.Resource{
- ReadContext: dataSourceValidateConfigurationRead,
- Schema: map[string]*schema.Schema{
- "json_config": {
- Type: schema.TypeMap,
- Required: true,
- },
- "rule_set": {
- Type: schema.TypeSet,
- Required: true,
- Elem: &schema.Resource{
- Schema: map[string]*schema.Schema{
- "key_name": {
- Type: schema.TypeString,
- Required: true,
- },
- "rule": {
- Type: schema.TypeString,
- Required: true,
- ValidateFunc: func(val any, key string) (warns []string, errs []error) {
- v := val.(string)
- rules := map[string]bool{
- "==": true,
- "!=": true,
- ">": true,
- "<": true,
- "<=": true,
- ">=": true,
- "contains": true,
- "odd": true,
- "even": true,
- "unique": true,
- }
- if !rules[v] {
- errs = append(errs, fmt.Errorf("%q must be one of the following rules [== | != | > | < | => | <= | contains | odd | even | unique] got: %d", key, v))
- }
- return
- },
- },
- "value": {
- Type: schema.TypeString,
- Required: true,
- },
- },
- },
- },
- },
- }
-}
-func Even(number int) bool {
- return number%2 == 0
-}
-
-func Odd(number int) bool {
- return !Even(number)
-}
-func getValue(config map[string]interface{}, elem string, key_name string) []string {
- if key_name == "key" {
- v := make(map[string]interface{})
- json.Unmarshal([]byte(elem), &v)
- k := make([]string, len(config))
- for s, _ := range v {
- k = append(k, s)
- }
- return k
- } else {
- v := interface{}(nil)
- json.Unmarshal([]byte(elem), &v)
- values, err := jsonpath.Get(key_name, v)
- if err != nil {
- fmt.Println(err)
- return nil
- }
- var k []string
- for _, value := range values.([]interface{}) {
- val := strings.ReplaceAll(fmt.Sprintln(value), "\n", "")
- k = append(k, val)
- }
- return k
- }
-}
-
-func dataSourceValidateConfigurationRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics {
-
- // // Warning or errors can be collected in a slice type
- var diags diag.Diagnostics
- //'add validation and return result
- configuration := d.Get("json_config").(map[string]interface{})
- validation_rule := d.Get("rule_set").(*schema.Set)
- for key, element := range configuration {
- fmt.Println("%b", key)
- elem := make(map[string]interface{})
- json.Unmarshal([]byte(element.(string)), &elem)
- rules := validation_rule.List()
- for i := range rules {
- rules_map := rules[i].(map[string]interface{})
- key_name := rules_map["key_name"].(string)
- rule := rules_map["rule"].(string)
- value := rules_map["value"].(string)
- if key_name == "" || rule == "" || value == "" {
- return diag.Errorf("missing param: %s", rules[i])
- }
- value_arr := getValue(configuration, element.(string), key_name)
- if len(value_arr) == 0 {
- return diag.Errorf("key: %s not found", key_name)
- }
- for v := range value_arr {
- switch {
- case rule == "==":
- if value_arr[v] != value {
- return diag.Errorf("Key %s in %s is not equal to: %s", key_name, value_arr, value)
- }
- case rule == "!=":
- if value_arr[v] == value {
- return diag.Errorf("Key %s in %s should not be equal to: %s", key_name, value_arr, value)
- }
- case rule == ">":
- intVar, err := strconv.Atoi(value_arr[v])
- intValue, err := strconv.Atoi(value)
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if intVar <= intValue {
- return diag.Errorf("Key %s in %s should be greater then: %s", key_name, value_arr, value)
- }
- case rule == "<":
- intVar, err := strconv.Atoi(value_arr[v])
- intValue, err := strconv.Atoi(value)
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if intVar >= intValue {
- return diag.Errorf("Key %s in %s should be lower then: %s", key_name, value_arr, value)
- }
- case rule == ">=":
- intVar, err := strconv.Atoi(value_arr[v])
- intValue, err := strconv.Atoi(value)
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if intVar < intValue {
- return diag.Errorf("Key %s in %s should be greater then or equal to: %s", key_name, value_arr, value)
- }
- case rule == "<=":
- intVar, err := strconv.Atoi(value_arr[v])
- intValue, err := strconv.Atoi(value)
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if intVar > intValue {
- return diag.Errorf("Key %s in %s should be lower then or equal to: %s", key_name, value_arr, value)
- }
- case rule == "contains":
- for _, s := range value_arr {
- if strings.Contains(s, value) {
- return diag.Errorf("Key %s in %s should not contain: %s", key_name, value_arr, value)
- }
- }
- case rule == "odd":
- intVar, err := strconv.Atoi(value_arr[v])
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if Even(intVar) {
- return diag.Errorf("Key %s with value %s is an even number but should be odd", key_name, value_arr[v])
- }
- case rule == "even":
- intVar, err := strconv.Atoi(value_arr[v])
- if err != nil {
- return diag.Errorf("Cannot compare string with number %s", value_arr[v])
- }
- if Odd(intVar) {
- return diag.Errorf("Key %s with value %s is an odd number but should be even", key_name, value_arr[v])
- }
- case rule == "unique":
- if key_name == "key" {
- count := 0
- key_regexp := fmt.Sprintf(`"%v".*:`, value)
- var re = regexp.MustCompile(key_regexp)
- for i, match := range re.FindAllString(element.(string), -1) {
- fmt.Println(match, "found at index", i)
- count++
- }
- if count > 1 {
- return diag.Errorf("Value %s in %s for Key %s is used more then once", value, value_arr, key_name)
- }
- }
- occurred := map[string]bool{}
- for v := range value_arr {
- if occurred[value_arr[v]] != true {
- occurred[value_arr[v]] = true
- } else {
- return diag.Errorf("Value %s in %s for Key %s is used more then once", value, value_arr, key_name)
- }
- }
- }
- }
- }
- }
- return diags
-}
diff --git a/internal/provider/provider.go b/internal/provider/provider.go
index aab74a4..21934d5 100644
--- a/internal/provider/provider.go
+++ b/internal/provider/provider.go
@@ -1,6 +1,17 @@
package toluna
import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "io/ioutil"
+ "net/http"
+ "os"
+ "strings"
+ toluna "terraform-provider-toluna/utils"
+
+ "github.com/hashicorp/go-version"
+ "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
@@ -34,15 +45,107 @@ type getItemsResponse struct {
Body getItemsResponseBody `json:"body"`
}
-func Provider() *schema.Provider {
+var (
+ config struct {
+ Paths []string
+ }
+)
+
+func init() {
+ schema.DescriptionKind = schema.StringMarkdown
+
+ schema.SchemaDescriptionBuilder = func(s *schema.Schema) string {
+ descriptionWithDefault := s.Description
+ if s.Default != nil {
+ descriptionWithDefault += fmt.Sprintf(" Defaults to `%v`.", s.Default)
+ }
+ return strings.TrimSpace(descriptionWithDefault)
+ }
+}
+
+func New() *schema.Provider {
+
return &schema.Provider{
- Schema: map[string]*schema.Schema{},
+ Schema: map[string]*schema.Schema{
+ "strict_module_validation": &schema.Schema{
+ Type: schema.TypeBool,
+ Optional: true,
+ Default: false,
+ },
+ },
ResourcesMap: map[string]*schema.Resource{
"toluna_invoke_lambda": resourceInvokeLambda(),
"toluna_start_codebuild": resourceStartCodebuild(),
},
DataSourcesMap: map[string]*schema.Resource{
- "toluna_validate_configuration": dataSourceValidateConfiguration(),
+ "toluna_environment_config": dataSourceEnvironmentConfig(),
},
+ ConfigureContextFunc: providerConfigure,
+ }
+}
+func providerConfigure(ctx context.Context, d *schema.ResourceData) (interface{}, diag.Diagnostics) {
+ var diags diag.Diagnostics
+ var severity diag.Severity
+ var message string
+ strict_module_validation := d.Get("strict_module_validation").(bool)
+ if strict_module_validation {
+ severity = 0
+ message = "You must updated to latest version to continue working."
+ } else {
+ severity = 1
+ message = "It is advised to update to latest version."
+ }
+ dir, err := os.Getwd()
+ if err != nil {
+ panic(err)
+ }
+ config.Paths = append(config.Paths, dir)
+ out, err := toluna.ScanModules(config.Paths)
+ if err != nil {
+ fmt.Println("failed to retrieve modules")
}
+ for _, r := range out {
+ if strings.HasPrefix(r.ModuleCall.Source, "toluna-terraform") {
+ remoteVersion := GetRemoteVersion(r.ModuleCall.Source)
+ localVersion := r.ModuleCall.Version
+ // Remove no-semver chars
+ localVersion = strings.ReplaceAll(localVersion, ">", "")
+ localVersion = strings.ReplaceAll(localVersion, "~", "")
+ localVersion = strings.ReplaceAll(localVersion, "=", "")
+ result := CompareVersions(remoteVersion, localVersion)
+ if result == true {
+ diags = append(diags, diag.Diagnostic{
+ Severity: severity,
+ Summary: "Module outdated: " + r.ModuleCall.Name + ", Under: " + r.Path,
+ Detail: "A newer module version of " + r.ModuleCall.Name + " [ " + localVersion + " ]" + " Is available [ " + remoteVersion + " ], " + message,
+ })
+ }
+ }
+ }
+ return nil, diags
+}
+
+func GetRemoteVersion(moduleName string) string {
+ baseURL := "https://registry.terraform.io/v1/modules/"
+ client := &http.Client{}
+ req, _ := http.NewRequest("GET", baseURL+moduleName, nil)
+ req.Header.Add("Accept", "application/json")
+ resp, err := client.Do(req)
+ if err != nil {
+ fmt.Println("Error reading terraform registry")
+ }
+
+ defer resp.Body.Close()
+ resp_body, _ := ioutil.ReadAll(resp.Body)
+ module_version := make(map[string]interface{})
+ if err := json.Unmarshal(resp_body, &module_version); err != nil { // Parse []byte to the go struct pointer
+ fmt.Println("Can not get remote version")
+ }
+ return module_version["version"].(string)
+}
+
+func CompareVersions(remoteVersion, localVersion string) bool {
+ lv, _ := version.NewVersion(localVersion)
+ rv, _ := version.NewVersion(remoteVersion)
+ return lv.LessThan(rv)
}
diff --git a/main.go b/main.go
index ebab3f4..42e7820 100644
--- a/main.go
+++ b/main.go
@@ -1,16 +1,33 @@
package main
import (
+ "context"
+ "flag"
+ "log"
+ toluna "terraform-provider-toluna/internal/provider"
+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
-
- toluna "terraform-provider-toluna/internal/provider"
)
func main() {
- plugin.Serve(&plugin.ServeOpts{
+
+ var debugMode bool
+ flag.BoolVar(&debugMode, "debug", false, "set to true to run the provider with support for debuggers like delve")
+ flag.Parse()
+ opts := &plugin.ServeOpts{
ProviderFunc: func() *schema.Provider {
- return toluna.Provider()
+ return toluna.New()
},
- })
+ ProviderAddr: "registry.terraform.io/toluna-terraform/toluna-v2",
+ }
+ if debugMode {
+ err := plugin.Debug(context.Background(), "toluna.com/edu/toluna-v2", opts)
+ if err != nil {
+ log.Fatal(err.Error())
+ }
+ return
+ }
+ log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime))
+ plugin.Serve(opts)
}
diff --git a/utils/scanner.go b/utils/scanner.go
new file mode 100644
index 0000000..0e8f98e
--- /dev/null
+++ b/utils/scanner.go
@@ -0,0 +1,32 @@
+package toluna
+
+import (
+ "fmt"
+
+ "github.com/hashicorp/terraform-config-inspect/tfconfig"
+)
+
+type Result struct {
+ ModuleCall tfconfig.ModuleCall
+ Path string
+}
+
+func ScanModules(paths []string) ([]Result, error) {
+ var out []Result
+ for _, path := range paths {
+ module, err := tfconfig.LoadModule(path)
+ if err != nil {
+ return nil, fmt.Errorf("read terraform module %q: %w", path, err)
+ }
+ for _, call := range module.ModuleCalls {
+ if call == nil {
+ continue
+ }
+ out = append(out, Result{
+ Path: call.Pos.Filename,
+ ModuleCall: *call,
+ })
+ }
+ }
+ return out, nil
+}