Open sudhanshujoshi23 opened 1 day ago
For context, my terraform configuration is applied successfully without any errors, the template and network profiles are created. But the network profile isn't attached to the template.
@sudhanshujoshi23 which DNAC version are you using?
I just creatd network profile and cli template and attach it as onboarding template to network_profile using following code:
terraform {
required_providers {
catalystcenter = {
source = "CiscoDevNet/catalystcenter"
version = "0.1.16"
}
}
}
resource "catalystcenter_project" "example" {
name = "Test_Project_1"
description = "My description"
}
resource "catalystcenter_template" "base_template" {
project_id = catalystcenter_project.example.id
name = "C9200-C9300_Template"
description = "Jinja Template"
device_types = [
{
product_family = "Switches and Hubs"
product_series = "Cisco Catalyst 9300 Series Switches"
product_type = "Cisco Catalyst 9300 Switch"
}
]
language = "JINJA"
software_type = "IOS-XE"
software_variant = "XE"
software_version = "16.12.1a"
template_content = "hostname Test"
composite = false
}
resource "catalystcenter_network_profile" "network_profile" {
name = "Network Profile for C9200-9300 switches"
type = "switching"
templates = [
{
type = "day0.templates"
attributes = [
{
template_id = catalystcenter_template.base_template.id
}
]
}
]
}
and I can see template being attached to network profile:
If terraform config was applied successfully without any errors, are you sure you cannot see template attached to network profile under Network Profiles -> Edit ?
The DNAC version I am using is Version 2.3.5.3-70194 The terraform provider version I am using is 0.1.15 And yes I am sure that I can't see the network profile being attached to the template. I tried the exact same code in the example you provided, but the network profile wasn't attached to the template after successful apply.
Can you try upgrading to 2.3.7.X , provider was tested against 2.3.7 version of CC.
This will need some time... Also, can you confirm if the templates needs to be committed before they can be attached to any network profile? If that's the case, can you point me to the documentation which I can use for committing the template?
Thanks!
For commiting template you need to use resource: https://registry.terraform.io/providers/CiscoDevNet/catalystcenter/latest/docs/resources/template_version
and code can look like this:
resource "catalystcenter_template" "base_template" {
project_id = catalystcenter_project.example.id
name = "C9200-C9300_Template"
description = "Jinja Template"
device_types = [
{
product_family = "Switches and Hubs"
product_series = "Cisco Catalyst 9300 Series Switches"
product_type = "Cisco Catalyst 9300 Switch"
}
]
language = "JINJA"
software_type = "IOS-XE"
software_variant = "XE"
software_version = "16.12.1a"
template_content = "hostname Test"
composite = false
}
resource "catalystcenter_template_version" "example" {
template_id = catalystcenter_template.base_template.id
comments = "New Version"
}
Adding the version resource didn't help either. There were no errors during the terraform apply.
Also, if I just go and attach the network profile manually to this newly created template using the catalyst center web portal, it works. So I am not sure what's wrong with the terraform code.
I don't think there is a problem with terraform code. This resource is using internal API endpoint: /api/v1/siteprofile, which might not work on your DNAC version. As i mentioned provider is tested against 2.3.7 DNAC version.
I would recommend to upgrade to 2.3.7.X and try again.
I am trying to attach a network profile to a day0 template using the below configuration, but I don't understand why it doesn't work. Can someone please let me know what I am missing here?