ovh / terraform-provider-ovh

Terraform OVH provider
https://registry.terraform.io/providers/ovh/ovh/latest/docs
Mozilla Public License 2.0
182 stars 133 forks source link

fix: set ip_restrictions type to set on containerregistry_ip_restrict… #645

Closed mxm-tr closed 3 months ago

mxm-tr commented 3 months ago

…ions

Description

Changes the type of ip_restrictions in containerregistry_ip_restrictions resources and data from schema.TypeList to schema.TypeSet.

Fixes #636

Type of change

How Has This Been Tested?

Tests have been added to verify that the order of the ip_restrictions does not influence the configuration and the state.

Test Configuration:


terraform {
  required_providers {
    ovh = {
      source = "ovh/ovh"
      source = "terraform.local/local/ovh"
    }
  }
}

provider "ovh" {
  endpoint           = "ovh-eu"
  application_key    = "xxx"
  application_secret = "yyy"
  consumer_key       = "zzz"
}

data "ovh_cloud_project_capabilities_containerregistry_filter" "regcap" {
  service_name = "xxx"
  plan_name    = "SMALL"
  region       = "GRA"
}

resource "ovh_cloud_project_containerregistry" "registry" {
  service_name = data.ovh_cloud_project_capabilities_containerregistry_filter.regcap.service_name
  plan_id      = data.ovh_cloud_project_capabilities_containerregistry_filter.regcap.id
  region       = data.ovh_cloud_project_capabilities_containerregistry_filter.regcap.region
  name         = "mydockerregistry"
}

resource "ovh_cloud_project_containerregistry_ip_restrictions_management" "my-mgt-iprestrictions" {
  service_name = ovh_cloud_project_containerregistry.registry.service_name
  registry_id  = ovh_cloud_project_containerregistry.registry.id

  ip_restrictions = [
    {
      ip_block    = "192.168.0.1/32"
      description = "xxxxxxx"
    },
    {
      ip_block    = "192.168.0.3/32"
      description = "xxxxxxx"
    }
  ]
}

resource "ovh_cloud_project_containerregistry_ip_restrictions_registry" "my-registry-iprestrictions" {
  service_name = ovh_cloud_project_containerregistry.registry.service_name
  registry_id  = ovh_cloud_project_containerregistry.registry.id

  ip_restrictions = [
    {
      ip_block    = "192.168.0.1/32"
      description = "xxxxxxx"
    },
    {
      ip_block    = "192.168.0.4/32"
      description = "xxxxxxx"
    }
  ]
}

Checklist:

amstuta commented 3 months ago

@mxm-tr any news ?

mxm-tr commented 3 months ago

@mxm-tr any news ?

Yes, I had some questions about the comments on the review, cf the comments above