diff --git a/connector/terraform/README.md b/connector/terraform/README.md
index 7bf5ab4..c35e9f5 100644
--- a/connector/terraform/README.md
+++ b/connector/terraform/README.md
@@ -115,7 +115,7 @@ No resources.
| [elastio_pat](#input_elastio_pat) | Personal Access Token generated by the Elastio Portal | `string` | n/a | yes |
| [elastio_tenant](#input_elastio_tenant) | Name of your Elastio tenant. For example `mycompany.app.elastio.com` | `string` | n/a | yes |
| [encrypt_with_cmk](#input_encrypt_with_cmk) | Provision additional customer-managed KMS keys to encrypt
Lambda environment variables, DynamoDB tables, S3. Note that
by default data is encrypted with AWS-managed keys.
Enable this option only if your compliance requirements mandate the usage of CMKs.
If this option is disabled Elastio creates only 1 CMK per region where
the Elastio Connector stack is deployed. If this option is enabled then
Elastio creates 1 KMS key per AWS account and 2 KMS keys per every AWS
region where Elastio is deployed in your AWS account.
If you have `elastio_nat_provision_stack` enabled as well, then 1 more KMS key
will be created as part of that stack as well (for a total of 3 KMS keys per region). | `bool` | `null` | no |
-| [global_managed_policies](#input_global_managed_policies) | List of IAM managed policies ARNs to attach to all Elastio IAM roles | `list(string)` | `null` | no |
+| [global_managed_policies](#input_global_managed_policies) | List of IAM managed policies ARNs to attach to all Elastio IAM roles | `set(string)` | `null` | no |
| [global_permission_boundary](#input_global_permission_boundary) | The ARN of the IAM managed policy to use as a permission boundary for all Elastio IAM roles | `string` | `null` | no |
| [iam_resource_names_prefix](#input_iam_resource_names_prefix) | Add a custom prefix to names of all IAM resources deployed by this stack.
The sum of the length of the prefix and suffix must not exceed 14 characters. | `string` | `null` | no |
| [iam_resource_names_static](#input_iam_resource_names_static) | If enabled, the stack will use static resource names without random characters in them.
This parameter is set to `true` by default, and it shouldn't be changed. The older
versions of Elastio stack used random names generated by Cloudformation for IAM
resources, which is inconvenient to work with. New deployments that use the terraform
automation should have this set to `true` for easier management of IAM resources. | `bool` | `true` | no |
diff --git a/connector/terraform/examples/advanced/.terraform.lock.hcl b/connector/terraform/examples/advanced/.terraform.lock.hcl
new file mode 100644
index 0000000..b7655d4
--- /dev/null
+++ b/connector/terraform/examples/advanced/.terraform.lock.hcl
@@ -0,0 +1,45 @@
+# This file is maintained automatically by "terraform init".
+# Manual edits may be lost in future updates.
+
+provider "registry.terraform.io/hashicorp/aws" {
+ version = "5.61.0"
+ constraints = "5.61.0"
+ hashes = [
+ "h1:VE5N7OZPW6/SRMTWX5JZ9XDMcwvs9GhUtSzhVG7DLIg=",
+ "zh:1a0a150b6adaeacc8f56763182e76c6219ac67de1217b269d24b770067b7bab0",
+ "zh:1d9c3a8ac3934a147569254d6e2e6ea5293974d0595c02c9e1aa31499a8f0042",
+ "zh:1f4d1d5e2e02fd5cccafa28dade8735a3059ed1ca3284fb40116cdb67d0e7ee4",
+ "zh:26be6f759bded469de477f54c7eb7a9ca9f137a3b52f9fd26cbd864f16973912",
+ "zh:276e308ae7aa281fe24f7275673aa05f00cb830b83c2b9797f9aa55f10769c52",
+ "zh:45c09beeadb4269d518de0bd341cbe9f061157ab54c543d39168ecefff40bbe2",
+ "zh:58fb5ef076dc63e284ce28b47b7cc35a17d2596f11e2373fe568c6140277e9d8",
+ "zh:64d51cc1ad412379f64b75883a881a5d682a8e9737ad14479f6a2d62e77f7dbe",
+ "zh:71e2e332317cf095288d65a801e95b65fd696204997b2db5250862d6c5669518",
+ "zh:9864014aa4716b5bfb3b27d009f158dd6a67c215fd0dfbe3a5d1a7cee72c5677",
+ "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
+ "zh:d8bf9ba43bd938faab37d8fb515c32a905d6dace60f5ff2663b06ffdc89a62e9",
+ "zh:e654be9d3980e7cc70f9825fe0d0205e254edd87832f18b2d7f9c72b09b776cd",
+ "zh:ee5ce6fbe75be3e90cabba3fad76fcfde50ab795e523b4ee917cfe8ba8ad42fe",
+ "zh:ef12098e7b3ddf9ab286bb209de87dfa8e52106049ced0841e3e6487dbff3659",
+ ]
+}
+
+provider "registry.terraform.io/hashicorp/http" {
+ version = "3.4.4"
+ constraints = "3.4.4"
+ hashes = [
+ "h1:dDGRXAVxwKgjVzA7VsO7MpYxt+eHnJosFV7rPZ4842o=",
+ "zh:28910c348aff60df15cb70c2838c5dac463de5d52fe41a511f122b0b5fa6032d",
+ "zh:61ddcdb703900b01a8d38c67bd68304e87e05aa82c2d6636a5c49813b0cee8bf",
+ "zh:6d7ba9fcebff1079b9cbad066874d83680a4aedc997baa597927f59b29a69186",
+ "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3",
+ "zh:82caa166f57808dd8421e9edf51bca0692135ca06ab548d5a2e3fe612bdd45a6",
+ "zh:95cb8ece59966d8f4020660879728dabaa158b3d188f22c0b92229347e740346",
+ "zh:ae56558b4262a4de250eec83e200ea4647badde10d1a14ed273f4daff650336f",
+ "zh:c1c5051eab9d9759fdb31bca6d7575a693558887a1156fa5f268963e05be4d92",
+ "zh:c90234ce3877e54be5b43493f51b582c6f9cb09138844cb048f63e9cd9f230fa",
+ "zh:cb237c6c47f085bf15149d6d2727b8bf108267582a30e7e2cd7393115896d003",
+ "zh:e7d782985f8b422cf265a856541ddb14f0d3ab0b54eb1aad6087ccfedacc7335",
+ "zh:ed0cc12d15226499fc7d173ad2b156c1934efae718cf254e79ca7f0ccd686b6d",
+ ]
+}
diff --git a/connector/terraform/examples/advanced/main.tf b/connector/terraform/examples/advanced/main.tf
new file mode 100644
index 0000000..8bbddd3
--- /dev/null
+++ b/connector/terraform/examples/advanced/main.tf
@@ -0,0 +1,17 @@
+module "elastio_connectors" {
+ source = "../../"
+
+ elastio_tenant = var.elastio_tenant
+ elastio_pat = var.elastio_pat
+
+ elastio_cloud_connectors = [
+ {
+ region = "us-east-1"
+ },
+ {
+ region = "us-east-2",
+ }
+ ]
+
+ global_managed_policies = var.global_managed_policies
+}
diff --git a/connector/terraform/examples/advanced/variables.tf b/connector/terraform/examples/advanced/variables.tf
new file mode 100644
index 0000000..5c94ac8
--- /dev/null
+++ b/connector/terraform/examples/advanced/variables.tf
@@ -0,0 +1,18 @@
+variable "elastio_pat" {
+ description = "Personal Access Token generated by the Elastio Portal"
+ sensitive = true
+ type = string
+ nullable = false
+}
+
+variable "elastio_tenant" {
+ description = "Name of your Elastio tenant. For example `mycompany.app.elastio.com`"
+ type = string
+ nullable = false
+}
+
+variable "global_managed_policies" {
+ description = "List of IAM managed policies ARNs to attach to all Elastio IAM roles"
+ type = set(string)
+ default = null
+}
diff --git a/connector/terraform/examples/advanced/versions.tf b/connector/terraform/examples/advanced/versions.tf
new file mode 100644
index 0000000..ab789a3
--- /dev/null
+++ b/connector/terraform/examples/advanced/versions.tf
@@ -0,0 +1,3 @@
+terraform {
+ required_version = "~> 1.0"
+}
diff --git a/connector/terraform/modules/region/main.tf b/connector/terraform/modules/region/main.tf
index c5bc302..45029f1 100644
--- a/connector/terraform/modules/region/main.tf
+++ b/connector/terraform/modules/region/main.tf
@@ -18,7 +18,7 @@ resource "terraform_data" "elastio_cloud_connector" {
input = local.connector_config
triggers_replace = {
connector = local.connector_config,
- account_stack = var.connector_account_stack.name,
+ account_stack = var.connector_account_stack,
}
provisioner "local-exec" {
diff --git a/connector/terraform/variables.tf b/connector/terraform/variables.tf
index 1e7693c..b020ab1 100644
--- a/connector/terraform/variables.tf
+++ b/connector/terraform/variables.tf
@@ -122,14 +122,30 @@ variable "lambda_tracing" {
variable "global_managed_policies" {
description = "List of IAM managed policies ARNs to attach to all Elastio IAM roles"
- type = list(string)
+ type = set(string)
default = null
+
+ validation {
+ condition = alltrue([
+ for policy in coalesce(var.global_managed_policies, []) :
+ can(regex("^arn:[^:]*:iam::[0-9]+:policy/.+$", policy))
+ ])
+ error_message = "global_managed_policies must be a list of ARNs"
+ }
}
variable "global_permission_boundary" {
description = "The ARN of the IAM managed policy to use as a permission boundary for all Elastio IAM roles"
type = string
default = null
+
+ validation {
+ condition = (
+ var.global_permission_boundary == null ||
+ can(regex("^arn:[^:]*:iam::[0-9]+:policy/.+$", var.global_permission_boundary))
+ )
+ error_message = "global_permission_boundary must be an ARN"
+ }
}
variable "iam_resource_names_prefix" {