CiscoDevNet / terraform-provider-sdwan

Terraform Cisco SD-WAN Provider
https://registry.terraform.io/providers/CiscoDevNet/sdwan
Mozilla Public License 2.0
19 stars 12 forks source link

control policy can be empty, is "sequences" a required attribute? #312

Closed cmohorea closed 1 month ago

cmohorea commented 3 months ago

I have an empty policy with just a default deny action: image

terraform import takes it in just fine:

    {
      "mode": "managed",
      "type": "sdwan_custom_control_topology_policy_definition",
      "name": "CLOUD_GATEWAY_POLICY",
      "provider": "provider[\"registry.terraform.io/ciscodevnet/sdwan\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "default_action": "reject",
            "description": "Topology policy for Cloud Gateway routers",
            "id": "036a515b-bbad-4512-825d-9f4e5ec2bb88",
            "name": "CLOUD_GATEWAY_POLICY",
            "sequences": null,
            "type": null,
            "version": null
          },
          "sensitive_attributes": []
        }
      ]
    },

Corresponding resource:

resource "sdwan_custom_control_topology_policy_definition" "test_CLOUD_GATEWAY_POLICY" {
  name = "test_CLOUD_GATEWAY_POLICY"
  description = "Topology policy for Cloud Gateway routers"
  default_action = "reject"
}

However, it generates an error:

│ Error: Missing required argument
│ 
│   on sdwan-tf-import-main.tf line 11576, in resource "sdwan_custom_control_topology_policy_definition" "CLOUD_GATEWAY_POLICY":
│ 11576: resource "sdwan_custom_control_topology_policy_definition" "CLOUD_GATEWAY_POLICY" {
│ 
│ The argument "sequences" is required, but no definition was found.

If I add sequences = null to config, getting this

│ Error: Missing Configuration for Required Attribute
│ 
│   with sdwan_custom_control_topology_policy_definition.test_CLOUD_GATEWAY_POLICY,
│   on sdwan-tf-import-main.tf line 25, in resource "sdwan_custom_control_topology_policy_definition" "test_CLOUD_GATEWAY_POLICY":
│   25:   sequences = null
│ 
│ Must set a configuration value for the sequences attribute as the provider has marked it as required.
│ 
│ Refer to the provider documentation or contact the provider developers for additional information about configurable attributes that are required.
cmohorea commented 3 months ago

it seems to be working with sequences = [], however, then terraform import should then should do it as [] not as Null can it be fixed either way (making it not required seems more logical to me)

seconroy commented 1 month ago

Released in v0.5.0.