diff --git a/example/README.md b/example/README.md new file mode 100644 index 0000000..685fe0b --- /dev/null +++ b/example/README.md @@ -0,0 +1,9 @@ +# Important +As for now currently examples inside this folder are just to show how some specific resources could look like, or how they could be implemented. +Examples inside this folder are not intended to provide complete picture or full working example. +Please be careful to understand what resources you copy from this folder and give it a double check if it will suite your needs (or not) and adjust this code to your specific needs. + +## Some generic consideration +If you have small amount of users it is okay to use local users (created inside CloudConnexa), examples in this folder will help you to achieve this. +If you have quite big amount of users - at some point it would be beneficial to look into managing users via LDAP or SAML. It is not possible (yet) configure LDAP and SAML settings via Terraform provider, this functionality will be added in the future releases. +If you have configured LDAP or SAML via CloudConnexa Admin UI - then using Terraform resource "cloudconnexa_user" will be not needed. diff --git a/example/user_groups.tf b/example/user_groups.tf index ce8e587..0afc045 100644 --- a/example/user_groups.tf +++ b/example/user_groups.tf @@ -1,5 +1,16 @@ +# Simple example resource "cloudconnexa_user_group" "this" { name = "test-group" vpn_region_ids = ["eu-central-1"] connect_auth = "AUTH" } + +# Advanced example +resource "cloudconnexa_user_group" "this" { + for_each = var.user_groups + name = each.key + connect_auth = try(each.value.connect_auth, "AUTO") + internet_access = try(each.value.internet_access, "LOCAL") + max_device = try(each.value.max_device, 3) + all_regions_included = true +} diff --git a/example/variables.tf b/example/variables.tf index 95bdead..2da1532 100644 --- a/example/variables.tf +++ b/example/variables.tf @@ -26,7 +26,7 @@ variable "users" { group = "Developer" role = "MEMBER" } - "Username3" = { + "Max_Mustermann" = { username = "Username3" email = "username3@company.com" group = "Support" @@ -68,3 +68,18 @@ variable "routes" { }, ] } + +variable "user_groups" { + description = "Variable for specifying configuration for User Groups" + type = map(object({ + connect_auth = optional(string) + internet_access = optional(string) + max_device = optional(number) + })) + default = { + admins = { max_device = 10 } + users = { max_device = 6 } + support = {} + marketing = {} + } +}