diff --git a/apstra/blueprint/pool_allocation.go b/apstra/blueprint/pool_allocation.go index 9d8f8aff..18facde2 100644 --- a/apstra/blueprint/pool_allocation.go +++ b/apstra/blueprint/pool_allocation.go @@ -15,6 +15,8 @@ import ( "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier" "github.com/hashicorp/terraform-plugin-framework/schema/validator" "github.com/hashicorp/terraform-plugin-framework/types" + "sort" + "strings" ) type PoolAllocation struct { @@ -26,6 +28,9 @@ type PoolAllocation struct { } func (o PoolAllocation) ResourceAttributes() map[string]resourceSchema.Attribute { + sortedRoles := utils.AllResourceGroupNameStrings() + sort.Strings(sortedRoles) + return map[string]resourceSchema.Attribute{ "blueprint_id": resourceSchema.StringAttribute{ MarkdownDescription: "Apstra ID of the Blueprint to which the Resource Pool should be allocated.", @@ -43,9 +48,10 @@ func (o PoolAllocation) ResourceAttributes() map[string]resourceSchema.Attribute }, }, "role": resourceSchema.StringAttribute{ - MarkdownDescription: "Fabric Role (Apstra Resource Group Name)", - Required: true, - PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, + MarkdownDescription: "Fabric Role (Apstra Resource Group Name) must be one of:\n\n - " + + strings.Join(sortedRoles, "\n - ") + "\n", + Required: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.RequiresReplace()}, Validators: []validator.String{ stringvalidator.OneOf( utils.AllResourceGroupNameStrings()..., diff --git a/apstra/utils/rosetta.go b/apstra/utils/rosetta.go index 36fc26a1..ccdd7f52 100644 --- a/apstra/utils/rosetta.go +++ b/apstra/utils/rosetta.go @@ -26,6 +26,12 @@ const ( resourceGroupNameVxlanVnIds = "vni_virtual_network_ids" resourceGroupNameLeafL3PeerLinksIpv4 = "leaf_l3_peer_links" resourceGroupNameLeafL3PeerLinksIpv6 = "leaf_l3_peer_links_ipv6" + + // search for todos with 'enable_rosetta_for_pools_with_leading_ipv6' to enable rosetta for these items. + // total 18 occurences between this file and the test file + // resourceGroupNameSpineLeafLinkIpv6 = "spine_leaf_link_ips_ipv6" // todo: enable_rosetta_for_pools_with_leading_ipv6 + // resourceGroupNameSpineSuperspineLinkIpv6 = "spine_superspine_link_ips_ipv6" // todo: enable_rosetta_for_pools_with_leading_ipv6 + // resourceGroupNameToGenericLinkIpv6 = "to_generic_link_ips_ipv6" // todo: enable_rosetta_for_pools_with_leading_ipv6 ) type StringerWithFromString interface { @@ -173,6 +179,12 @@ func resourceGroupNameToFriendlyString(in apstra.ResourceGroupName) string { return resourceGroupNameLeafL3PeerLinksIpv6 case apstra.ResourceGroupNameVxlanVnIds: return resourceGroupNameVxlanVnIds + // case apstra.ResourceGroupNameSpineLeafIp6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // return resourceGroupNameSpineLeafLinkIpv6 // todo: enable_rosetta_for_pools_with_leading_ipv6 + // case apstra.ResourceGroupNameSuperspineSpineIp6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // return resourceGroupNameSpineSuperspineLinkIpv6 // todo: enable_rosetta_for_pools_with_leading_ipv6 + // case apstra.ResourceGroupNameToGenericLinkIpv6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // return resourceGroupNameToGenericLinkIpv6 // todo: enable_rosetta_for_pools_with_leading_ipv6 } return in.String() @@ -292,6 +304,12 @@ func resourceGroupNameFromFriendlyString(target *apstra.ResourceGroupName, in .. *target = apstra.ResourceGroupNameLeafL3PeerLinkLinkIp6 case resourceGroupNameVxlanVnIds: *target = apstra.ResourceGroupNameVxlanVnIds + // case resourceGroupNameSpineLeafLinkIpv6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // *target = apstra.ResourceGroupNameSpineLeafIp6 // todo: enable_rosetta_for_pools_with_leading_ipv6 + // case resourceGroupNameSpineSuperspineLinkIpv6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // *target = apstra.ResourceGroupNameSuperspineSpineIp6 // todo: enable_rosetta_for_pools_with_leading_ipv6 + // case resourceGroupNameToGenericLinkIpv6: // todo: enable_rosetta_for_pools_with_leading_ipv6 + // *target = apstra.ResourceGroupNameToGenericLinkIpv6 // todo: enable_rosetta_for_pools_with_leading_ipv6 default: return target.FromString(in[0]) } diff --git a/apstra/utils/rosetta_test.go b/apstra/utils/rosetta_test.go index c9831650..af6f260e 100644 --- a/apstra/utils/rosetta_test.go +++ b/apstra/utils/rosetta_test.go @@ -41,6 +41,10 @@ func TestRosetta(t *testing.T) { {string: "vni_virtual_network_ids", stringers: []fmt.Stringer{apstra.ResourceGroupNameVxlanVnIds}}, {string: "leaf_l3_peer_links", stringers: []fmt.Stringer{apstra.ResourceGroupNameLeafL3PeerLinkLinkIp4}}, {string: "leaf_l3_peer_links_ipv6", stringers: []fmt.Stringer{apstra.ResourceGroupNameLeafL3PeerLinkLinkIp6}}, + + //{string: "spine_leaf_link_ips_ipv6", stringers: []fmt.Stringer{apstra.ResourceGroupNameSpineLeafIp6}}, // todo: enable_rosetta_for_pools_with_leading_ipv6 + //{string: "spine_superspine_link_ips_ipv6", stringers: []fmt.Stringer{apstra.ResourceGroupNameSuperspineSpineIp6}}, // todo: enable_rosetta_for_pools_with_leading_ipv6 + //{string: "to_generic_link_ips_ipv6", stringers: []fmt.Stringer{apstra.ResourceGroupNameToGenericLinkIpv6}}, // todo: enable_rosetta_for_pools_with_leading_ipv6 } for i, tc := range testCases { diff --git a/docs/resources/datacenter_resource_pool_allocation.md b/docs/resources/datacenter_resource_pool_allocation.md index 9438b45f..ddd10f30 100644 --- a/docs/resources/datacenter_resource_pool_allocation.md +++ b/docs/resources/datacenter_resource_pool_allocation.md @@ -65,7 +65,39 @@ resource "apstra_datacenter_resource_pool_allocation" "ipv4" { - `blueprint_id` (String) Apstra ID of the Blueprint to which the Resource Pool should be allocated. - `pool_ids` (Set of String) Apstra IDs of the Resource Pools to be allocated to the given Blueprint role. -- `role` (String) Fabric Role (Apstra Resource Group Name) +- `role` (String) Fabric Role (Apstra Resource Group Name) must be one of: + + - access_asns + - access_l3_peer_link_link_ips + - access_loopback_ips + - evpn_l3_vnis + - generic_asns + - generic_loopback_ips + - generic_loopback_ips_ipv6 + - ipv6_spine_leaf_link_ips + - ipv6_spine_superspine_link_ips + - ipv6_to_generic_link_ips + - leaf_asns + - leaf_l3_peer_links + - leaf_l3_peer_links_ipv6 + - leaf_leaf_link_ips + - leaf_loopback_ips + - leaf_loopback_ips_ipv6 + - mlag_domain_svi_subnets + - mlag_domain_svi_subnets_ipv6 + - spine_asns + - spine_leaf_link_ips + - spine_loopback_ips + - spine_loopback_ips_ipv6 + - spine_superspine_link_ips + - superspine_asns + - superspine_loopback_ips + - superspine_loopback_ips_ipv6 + - to_generic_link_ips + - virtual_network_svi_subnets + - virtual_network_svi_subnets_ipv6 + - vni_virtual_network_ids + - vtep_ips ### Optional