Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[UX2.0] Configuration-group creation fails after initial deployment failure #390

Open
tzarski0 opened this issue Jan 14, 2025 · 0 comments
Assignees

Comments

@tzarski0
Copy link
Collaborator

Configure the following data model (note that in this data model, we on purpose didn't include some required variables):

resource "sdwan_system_feature_profile" "system1" {
  name        = "system1"
  description = ""
}

resource "sdwan_system_feature_profile" "transport1" {
  name        = "transport1"
  description = ""
}

resource "sdwan_configuration_group" "cg1" {
  description = "configuration group 1"
  devices = [
    {
      deploy = true
      id     = "C8K-172343D2-7380-8B1B-5509-6FCB24AFA689"
      variables = [
        {
          name  = "host_name"
          value = "Edge2"
        }
      ]
    }
  ]
  feature_profiles = [{
    id = sdwan_system_feature_profile.system1.id
  }]
  name     = "cg1"
  solution = "sdwan"
}

This will fail with the below error. This error is expected as we didn't fill some of the required variables:

│ Error: Client Error
│ 
│   with sdwan_configuration_group.cg1,
│   on main.tf line 26, in resource "sdwan_configuration_group" "cg1":
│   26: resource "sdwan_configuration_group" "cg1" {
│ 
│ Failed to configure configuration group device variables (PUT), got error: HTTP Request failed:
│ StatusCode 400, {"error":{"message":"Invalid Json Payload
│ Input","code":"SCHVALID0001","details":"{\"Validation Errors\":{\"Required But Missing
│ Attributes\":[\"pseudo_commit_timer\",\"site_id\",\"system_ip\"]}}","type":"error"}}
╵

Now if you try to trigger the apply again, TF will again try to create this resource and will fail as it already created it in the previous apply:

╷
│ Error: Client Error
│ 
│   with sdwan_configuration_group.cg1,
│   on main.tf line 26, in resource "sdwan_configuration_group" "cg1":
│   26: resource "sdwan_configuration_group" "cg1" {
│ 
│ Failed to configure configuration group (POST), got error: HTTP Request failed: StatusCode 400,
│ {"error":{"message":"Failed to create config group.","code":"CFGRP0001","details":"config group with
│ name 'cg1' already exists","type":"error"}}

This is not expected and should be fixed. If first apply created a config group correctly and attachment failed, then on next TF apply we should just add devices block to existing config group resource and not try to recreate config group again.

@seconroy seconroy self-assigned this Jan 15, 2025
seconroy added a commit to seconroy/terraform-provider-sdwan that referenced this issue Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants