OpenVPN / terraform-provider-cloudconnexa

OpenVPN Terraform CloudConnexa provider
https://registry.terraform.io/providers/OpenVPN/cloudconnexa
Apache License 2.0
7 stars 2 forks source link

Add ability to select all regions when using "cloudconnexa_user_group" #15

Closed sahaqaa closed 1 month ago

sahaqaa commented 3 months ago

Current use-case: let's say i want to create User Group and select all regions, here is example of how it would look like with current version of Terraform Provider:

variable "cloudconnexa_user_group_all_vpn_region_ids" {
  description = "Regions which can be used"
  type        = list(string)
  default = [
    "se-arn",
    "us-ewr",
    "us-pdx",
    "ap-south-1",
    "us-bos",
    "us-mia",
    "fr-cdg",
    "ie-dub",
    "ca-east-1",
    "eu-central-1",
    "ca-yvr",
    "eu-central-2",
    "us-central-1",
    "us-west-1",
    "us-cmh",
    "us-west-2",
    "il-tlv",
    "af-south-1",
    "us-south-1",
    "it-mxp",
    "eu-west-1",
    "fi-hel",
    "us-sea",
    "jp-hnd",
    "es-mad",
    "us-mci",
    "ch-zrh",
    "ap-southeast-1",
    "ap-southeast-2",
    "pl-waw",
    "br-gru",
    "us-atl",
    "be-bru",
    "us-east-1",
    "ca-yul",
  ]
}

resource "cloudconnexa_user_group" "this" {
  name            = "this_is_my_group"
  connect_auth    = "AUTO"
  internet_access = "LOCAL"
  max_device      = 3
  vpn_region_ids  = var.cloudconnexa_user_group_all_vpn_region_ids
}

Setting all regions seems like an overhead. In API there is ability to specify:

        "allRegionsIncluded": {
          "type": "boolean"
        },

If this would be implemented - code above could be simplified to:

resource "cloudconnexa_user_group" "this" {
  name            = "this_is_my_group"
  connect_auth    = "AUTO"
  internet_access = "LOCAL"
  max_device      = 3
  all_regions_included  = true
}
sahaqaa commented 3 months ago

Example of valid Swagger code:

{
  "allRegionsIncluded": true,
  "connectAuth": "AUTO",
  "internetAccess": "LOCAL",
  "maxDevice": 3,
  "name": "qqwwwert"
}

(POST ​"/api​/beta​/user-groups" Create a new user group)

sahaqaa commented 1 month ago

Implemented per https://github.com/OpenVPN/terraform-provider-cloudconnexa/pull/44