From 69aae582df8431f5f715db65587497eb0a8da6ad Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Fri, 28 Jun 2024 13:40:12 -0400 Subject: [PATCH 1/4] bump SDK version --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 8e51038a..41f594f2 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ toolchain go1.21.1 require ( github.com/IBM/netaddr v1.5.0 - github.com/Juniper/apstra-go-sdk v0.0.0-20240626014411-5b0eff26054c + github.com/Juniper/apstra-go-sdk v0.0.0-20240628141045-0b004d101c1e github.com/apparentlymart/go-cidr v1.1.0 github.com/chrismarget-j/go-licenses v0.0.0-20240224210557-f22f3e06d3d4 github.com/google/go-cmp v0.6.0 diff --git a/go.sum b/go.sum index 247745c4..df939ee5 100644 --- a/go.sum +++ b/go.sum @@ -108,8 +108,8 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= github.com/IBM/netaddr v1.5.0 h1:IJlFZe1+nFs09TeMB/HOP4+xBnX2iM/xgiDOgZgTJq0= github.com/IBM/netaddr v1.5.0/go.mod h1:DDBPeYgbFzoXHjSz9Jwk7K8wmWV4+a/Kv0LqRnb8we4= -github.com/Juniper/apstra-go-sdk v0.0.0-20240626014411-5b0eff26054c h1:7aqgHRKpIlHFZo4H4FKAbwhIP4T7tmu8m22SAHQ4zkg= -github.com/Juniper/apstra-go-sdk v0.0.0-20240626014411-5b0eff26054c/go.mod h1:Xwj3X8v/jRZWv28o6vQAqD4lz2JmzaSYLZ2ch1SS89w= +github.com/Juniper/apstra-go-sdk v0.0.0-20240628141045-0b004d101c1e h1:hMI6KM015U0nQZuMKWRL2QdwdwdzjpndxKM8dGZ9Kpw= +github.com/Juniper/apstra-go-sdk v0.0.0-20240628141045-0b004d101c1e/go.mod h1:Xwj3X8v/jRZWv28o6vQAqD4lz2JmzaSYLZ2ch1SS89w= github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= From ae383a6eadc6c965711bf6f7b740d39b14c46190 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Fri, 28 Jun 2024 14:59:01 -0400 Subject: [PATCH 2/4] update docs to show pool allocation roles --- apstra/blueprint/pool_allocation.go | 12 +++++-- apstra/utils/rosetta.go | 18 ++++++++++ apstra/utils/rosetta_test.go | 4 +++ .../datacenter_resource_pool_allocation.md | 34 ++++++++++++++++++- 4 files changed, 64 insertions(+), 4 deletions(-) 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 From a16065719c88c4ba890889f83060584a5395fd51 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Tue, 2 Jul 2024 21:28:41 -0400 Subject: [PATCH 3/4] brief review --- apstra/blueprint/freeform_config_template.go | 8 ++-- apstra/blueprint/freeform_property_set.go | 5 ++- apstra/blueprint/freeform_system.go | 23 +++++------ apstra/configure_resource.go | 4 -- .../data_source_freeform_config_template.go | 1 + apstra/data_source_freeform_property_set.go | 4 +- apstra/data_source_freeform_system.go | 2 +- apstra/resource_freeform_config_template.go | 5 +-- ...eeform_config_template_integration_test.go | 6 +-- apstra/resource_freeform_property_set.go | 6 +-- ..._freeform_property_set_integration_test.go | 8 ++-- apstra/resource_freeform_system.go | 6 +-- apstra/test_helpers_test.go | 8 ++-- docs/data-sources/freeform_config_template.md | 6 +-- docs/data-sources/freeform_property_set.md | 8 ++-- docs/data-sources/freeform_system.md | 41 +++++++++++++++++++ docs/resources/freeform_system.md | 41 +++++++++++++++++++ .../apstra_freeform_system/example.tf | 1 + .../apstra_freeform_system/example.tf | 1 + 19 files changed, 129 insertions(+), 55 deletions(-) create mode 100644 docs/data-sources/freeform_system.md create mode 100644 docs/resources/freeform_system.md create mode 100644 examples/data-sources/apstra_freeform_system/example.tf create mode 100644 examples/resources/apstra_freeform_system/example.tf diff --git a/apstra/blueprint/freeform_config_template.go b/apstra/blueprint/freeform_config_template.go index b0511d9e..14b4020a 100644 --- a/apstra/blueprint/freeform_config_template.go +++ b/apstra/blueprint/freeform_config_template.go @@ -34,7 +34,7 @@ func (o FreeformConfigTemplate) DataSourceAttributes() map[string]dataSourceSche Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "id": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up the Config Template by `id`. Required when `name` is omitted.", + MarkdownDescription: "Populate this field to look up the Config Template by ID. Required when `name` is omitted.", Optional: true, Computed: true, Validators: []validator.String{ @@ -46,7 +46,7 @@ func (o FreeformConfigTemplate) DataSourceAttributes() map[string]dataSourceSche }, }, "name": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up an imported Config Template by `name`. Required when `id` is omitted.", + MarkdownDescription: "Populate this field to look up an imported Config Template by Name. Required when `id` is omitted.", Optional: true, Computed: true, Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, @@ -54,13 +54,11 @@ func (o FreeformConfigTemplate) DataSourceAttributes() map[string]dataSourceSche "text": dataSourceSchema.StringAttribute{ MarkdownDescription: "Configuration Jinja2 template text", Computed: true, - Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "tags": dataSourceSchema.SetAttribute{ MarkdownDescription: "Set of Tag labels", ElementType: types.StringType, - Optional: true, - Validators: []validator.Set{setvalidator.SizeAtLeast(1)}, + Computed: true, }, } } diff --git a/apstra/blueprint/freeform_property_set.go b/apstra/blueprint/freeform_property_set.go index d746f321..e0038d1f 100644 --- a/apstra/blueprint/freeform_property_set.go +++ b/apstra/blueprint/freeform_property_set.go @@ -33,7 +33,7 @@ func (o FreeformPropertySet) DataSourceAttributes() map[string]dataSourceSchema. Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "id": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up a Freeform Property Set by `id`. Required when `name` is omitted.", + MarkdownDescription: "Populate this field to look up a Freeform Property Set by ID. Required when `name` is omitted.", Optional: true, Computed: true, Validators: []validator.String{ @@ -50,7 +50,7 @@ func (o FreeformPropertySet) DataSourceAttributes() map[string]dataSourceSchema. Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "name": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up an imported Property Set by `name`. Required when `id` is omitted.", + MarkdownDescription: "Populate this field to look up an imported Property Set by Name. Required when `id` is omitted.", Optional: true, Computed: true, Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, @@ -74,6 +74,7 @@ func (o FreeformPropertySet) ResourceAttributes() map[string]resourceSchema.Attr "id": resourceSchema.StringAttribute{ MarkdownDescription: "ID of the Property Set.", Computed: true, + PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()}, }, "system_id": resourceSchema.StringAttribute{ MarkdownDescription: "The system ID where the Property Set is associated.", diff --git a/apstra/blueprint/freeform_system.go b/apstra/blueprint/freeform_system.go index 919939ed..f2c7ff7c 100644 --- a/apstra/blueprint/freeform_system.go +++ b/apstra/blueprint/freeform_system.go @@ -2,6 +2,7 @@ package blueprint import ( "context" + "fmt" "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" @@ -37,7 +38,7 @@ func (o FreeformSystem) DataSourceAttributes() map[string]dataSourceSchema.Attri Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "id": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up the Freeform System by `id`. Required when `name` is omitted.", + MarkdownDescription: "Populate this field to look up the Freeform System by ID. Required when `name` is omitted.", Optional: true, Computed: true, Validators: []validator.String{ @@ -49,7 +50,7 @@ func (o FreeformSystem) DataSourceAttributes() map[string]dataSourceSchema.Attri }, }, "name": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Populate this field to look up System by `name`. Required when `id` is omitted.", + MarkdownDescription: "Populate this field to look up System by Name. Required when `id` is omitted.", Optional: true, Computed: true, Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, @@ -77,7 +78,7 @@ func (o FreeformSystem) DataSourceAttributes() map[string]dataSourceSchema.Attri "tags": dataSourceSchema.SetAttribute{ MarkdownDescription: "Set of Tag labels", ElementType: types.StringType, - Optional: true, + Computed: true, }, } } @@ -98,34 +99,30 @@ func (o FreeformSystem) ResourceAttributes() map[string]resourceSchema.Attribute "name": resourceSchema.StringAttribute{ MarkdownDescription: "Freeform System name as shown in the Web UI.", Required: true, - Validators: []validator.String{ - stringvalidator.LengthAtLeast(1), - }, + Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "hostname": resourceSchema.StringAttribute{ MarkdownDescription: "Hostname of the Freeform System.", Optional: true, - Validators: []validator.String{ - stringvalidator.LengthAtLeast(1), - }, + Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "deploy_mode": dataSourceSchema.StringAttribute{ - MarkdownDescription: "deploy mode of the System", + MarkdownDescription: "Deploy mode of the System", Optional: true, Validators: []validator.String{stringvalidator.OneOf(utils.AllNodeDeployModes()...)}, }, "type": dataSourceSchema.StringAttribute{ - MarkdownDescription: "type of the System, either Internal or External", + MarkdownDescription: fmt.Sprintf("Type of the System. Must be one of `%s` or `%s`", apstra.SystemTypeInternal, apstra.SystemTypeExternal), Required: true, Validators: []validator.String{stringvalidator.OneOf(apstra.SystemTypeInternal.String(), apstra.SystemTypeExternal.String())}, }, "device_profile_id": dataSourceSchema.StringAttribute{ - MarkdownDescription: "device profile ID of the System", + MarkdownDescription: "Device profile ID of the System", Optional: true, Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, "system_id": dataSourceSchema.StringAttribute{ - MarkdownDescription: "Device System ID assigned to the System", + MarkdownDescription: "ID (usually serial number) of the Managed Device to associate with this System", Optional: true, Validators: []validator.String{stringvalidator.LengthAtLeast(1)}, }, diff --git a/apstra/configure_resource.go b/apstra/configure_resource.go index e85598f6..4057df90 100644 --- a/apstra/configure_resource.go +++ b/apstra/configure_resource.go @@ -70,10 +70,6 @@ func configureResource(_ context.Context, rs resource.ResourceWithConfigure, req rs.setBpClientFunc(pd.getTwoStageL3ClosClient) } - if rs, ok := rs.(resourceWithSetDcBpClientFunc); ok { - rs.setBpClientFunc(pd.getTwoStageL3ClosClient) - } - if rs, ok := rs.(resourceWithSetFfBpClientFunc); ok { rs.setBpClientFunc(pd.getFreeformClient) } diff --git a/apstra/data_source_freeform_config_template.go b/apstra/data_source_freeform_config_template.go index ffa11364..654fa231 100644 --- a/apstra/data_source_freeform_config_template.go +++ b/apstra/data_source_freeform_config_template.go @@ -34,6 +34,7 @@ func (o *dataSourceFreeformConfigTemplate) Schema(_ context.Context, _ datasourc Attributes: blueprint.FreeformConfigTemplate{}.DataSourceAttributes(), } } + func (o *dataSourceFreeformConfigTemplate) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config blueprint.FreeformConfigTemplate resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) diff --git a/apstra/data_source_freeform_property_set.go b/apstra/data_source_freeform_property_set.go index 72bae6cb..19c47fbb 100644 --- a/apstra/data_source_freeform_property_set.go +++ b/apstra/data_source_freeform_property_set.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework/datasource" "github.com/hashicorp/terraform-plugin-framework/datasource/schema" "github.com/hashicorp/terraform-plugin-framework/path" + "github.com/hashicorp/terraform-plugin-framework/types" ) var _ datasource.DataSourceWithConfigure = &dataSourceFreeformPropertySet{} @@ -28,7 +29,7 @@ func (o *dataSourceFreeformPropertySet) Configure(ctx context.Context, req datas func (o *dataSourceFreeformPropertySet) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform PropertySet.\n\n" + + MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Property Set.\n\n" + "At least one optional attribute is required.", Attributes: blueprint.FreeformPropertySet{}.DataSourceAttributes(), } @@ -81,6 +82,7 @@ func (o *dataSourceFreeformPropertySet) Read(ctx context.Context, req datasource return } + config.Id = types.StringValue(api.Id.String()) config.LoadApiData(ctx, api.Data, &resp.Diagnostics) if resp.Diagnostics.HasError() { return diff --git a/apstra/data_source_freeform_system.go b/apstra/data_source_freeform_system.go index 6bb560d2..aeae02c0 100644 --- a/apstra/data_source_freeform_system.go +++ b/apstra/data_source_freeform_system.go @@ -29,7 +29,7 @@ func (o *dataSourceFreeformSystem) Configure(ctx context.Context, req datasource func (o *dataSourceFreeformSystem) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform Config Template.\n\n" + + MarkdownDescription: docCategoryFreeform + "This data source provides details of a specific Freeform System.\n\n" + "At least one optional attribute is required.", Attributes: blueprint.FreeformSystem{}.DataSourceAttributes(), } diff --git a/apstra/resource_freeform_config_template.go b/apstra/resource_freeform_config_template.go index 8b43145b..9878f686 100644 --- a/apstra/resource_freeform_config_template.go +++ b/apstra/resource_freeform_config_template.go @@ -118,7 +118,6 @@ func (o *resourceFreeformConfigTemplate) Read(ctx context.Context, req resource. resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } -// Update resource func (o *resourceFreeformConfigTemplate) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values var plan blueprint.FreeformConfigTemplate @@ -162,7 +161,6 @@ func (o *resourceFreeformConfigTemplate) Update(ctx context.Context, req resourc resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } -// Delete resource func (o *resourceFreeformConfigTemplate) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state blueprint.FreeformConfigTemplate resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -174,8 +172,7 @@ func (o *resourceFreeformConfigTemplate) Delete(ctx context.Context, req resourc bp, err := o.getBpClientFunc(ctx, state.BlueprintId.ValueString()) if err != nil { if utils.IsApstra404(err) { - resp.Diagnostics.AddError(fmt.Sprintf("blueprint %s not found", state.BlueprintId), err.Error()) - return + return // 404 is okay } resp.Diagnostics.AddError("failed to create blueprint client", err.Error()) return diff --git a/apstra/resource_freeform_config_template_integration_test.go b/apstra/resource_freeform_config_template_integration_test.go index cb95882f..9e941d50 100644 --- a/apstra/resource_freeform_config_template_integration_test.go +++ b/apstra/resource_freeform_config_template_integration_test.go @@ -19,9 +19,9 @@ const ( resourceFreeformConfigTemplateHcl = ` resource %q %q { blueprint_id = %q - name = %q - text = %q - tags = %s + name = %q + text = %q + tags = %s } ` ) diff --git a/apstra/resource_freeform_property_set.go b/apstra/resource_freeform_property_set.go index e546ad77..1ad39f56 100644 --- a/apstra/resource_freeform_property_set.go +++ b/apstra/resource_freeform_property_set.go @@ -118,7 +118,6 @@ func (o *resourceFreeformPropertySet) Read(ctx context.Context, req resource.Rea resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } -// Update resource func (o *resourceFreeformPropertySet) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values var plan blueprint.FreeformPropertySet @@ -158,11 +157,11 @@ func (o *resourceFreeformPropertySet) Update(ctx context.Context, req resource.U resp.Diagnostics.AddError("error updating Property Set", err.Error()) return } + // set state resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } -// Delete resource func (o *resourceFreeformPropertySet) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state blueprint.FreeformPropertySet resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -174,8 +173,7 @@ func (o *resourceFreeformPropertySet) Delete(ctx context.Context, req resource.D bp, err := o.getBpClientFunc(ctx, state.BlueprintId.ValueString()) if err != nil { if utils.IsApstra404(err) { - resp.Diagnostics.AddError(fmt.Sprintf("blueprint %s not found", state.BlueprintId), err.Error()) - return + return // 404 is okay } resp.Diagnostics.AddError("failed to create blueprint client", err.Error()) return diff --git a/apstra/resource_freeform_property_set_integration_test.go b/apstra/resource_freeform_property_set_integration_test.go index 787afc8d..9bff337d 100644 --- a/apstra/resource_freeform_property_set_integration_test.go +++ b/apstra/resource_freeform_property_set_integration_test.go @@ -28,7 +28,7 @@ resource %q %q { type resourceFreeformPropertySet struct { blueprintId string name string - system_id string + systemId string values json.RawMessage } @@ -36,7 +36,7 @@ func (o resourceFreeformPropertySet) render(rType, rName string) string { return fmt.Sprintf(resourceFreeformPropertySetHcl, rType, rName, o.blueprintId, - stringOrNull(o.system_id), + stringOrNull(o.systemId), o.name, string(o.values), ) @@ -51,8 +51,8 @@ func (o resourceFreeformPropertySet) testChecks(t testing.TB, rType, rName strin result.append(t, "TestCheckResourceAttr", "name", o.name) result.append(t, "TestCheckResourceAttr", "values", string(o.values)) - if o.system_id != "" { - result.append(t, "TestCheckResourceAttr", "system_id", o.system_id) + if o.systemId != "" { + result.append(t, "TestCheckResourceAttr", "system_id", o.systemId) } return result diff --git a/apstra/resource_freeform_system.go b/apstra/resource_freeform_system.go index bc88c665..0e36e620 100644 --- a/apstra/resource_freeform_system.go +++ b/apstra/resource_freeform_system.go @@ -118,7 +118,6 @@ func (o *resourceFreeformSystem) Read(ctx context.Context, req resource.ReadRequ resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) } -// Update resource func (o *resourceFreeformSystem) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { // Get plan values var plan blueprint.FreeformSystem @@ -158,11 +157,11 @@ func (o *resourceFreeformSystem) Update(ctx context.Context, req resource.Update resp.Diagnostics.AddError("error updating Freeform System", err.Error()) return } + // set state resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) } -// Delete resource func (o *resourceFreeformSystem) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { var state blueprint.FreeformSystem resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -174,8 +173,7 @@ func (o *resourceFreeformSystem) Delete(ctx context.Context, req resource.Delete bp, err := o.getBpClientFunc(ctx, state.BlueprintId.ValueString()) if err != nil { if utils.IsApstra404(err) { - resp.Diagnostics.AddError(fmt.Sprintf("blueprint %s not found", state.BlueprintId), err.Error()) - return + return // 404 is okay } resp.Diagnostics.AddError("failed to create blueprint client", err.Error()) return diff --git a/apstra/test_helpers_test.go b/apstra/test_helpers_test.go index 6f716940..8027f587 100644 --- a/apstra/test_helpers_test.go +++ b/apstra/test_helpers_test.go @@ -230,7 +230,8 @@ func randomStrings(strCount int, strLen int) []string { func randomJson(t testing.TB, maxInt int, strLen int, count int) json.RawMessage { t.Helper() - preResult := make(map[string]any) + + preResult := make(map[string]any, count) for i := 0; i < count; i++ { if rand.Int()%2 == 0 { preResult["a"+acctest.RandString(strLen-1)] = rand.Intn(maxInt) @@ -238,10 +239,11 @@ func randomJson(t testing.TB, maxInt int, strLen int, count int) json.RawMessage preResult["a"+acctest.RandString(strLen-1)] = acctest.RandString(strLen) } } - marshalResult, err := json.Marshal(&preResult) + + result, err := json.Marshal(&preResult) require.NoError(t, err) - return marshalResult + return result } type lineNumberer struct { diff --git a/docs/data-sources/freeform_config_template.md b/docs/data-sources/freeform_config_template.md index 15a21057..81f2118e 100644 --- a/docs/data-sources/freeform_config_template.md +++ b/docs/data-sources/freeform_config_template.md @@ -32,10 +32,10 @@ data "apstra_freeform_config_template" "interfaces" { ### Optional -- `id` (String) Populate this field to look up the Config Template by `id`. Required when `name` is omitted. -- `name` (String) Populate this field to look up an imported Config Template by `name`. Required when `id` is omitted. -- `tags` (Set of String) Set of Tag labels +- `id` (String) Populate this field to look up the Config Template by ID. Required when `name` is omitted. +- `name` (String) Populate this field to look up an imported Config Template by Name. Required when `id` is omitted. ### Read-Only +- `tags` (Set of String) Set of Tag labels - `text` (String) Configuration Jinja2 template text diff --git a/docs/data-sources/freeform_property_set.md b/docs/data-sources/freeform_property_set.md index 5c0c1684..a6df6e35 100644 --- a/docs/data-sources/freeform_property_set.md +++ b/docs/data-sources/freeform_property_set.md @@ -2,13 +2,13 @@ page_title: "apstra_freeform_property_set Data Source - terraform-provider-apstra" subcategory: "Reference Design: Freeform" description: |- - This data source provides details of a specific Freeform PropertySet. + This data source provides details of a specific Freeform Property Set. At least one optional attribute is required. --- # apstra_freeform_property_set (Data Source) -This data source provides details of a specific Freeform PropertySet. +This data source provides details of a specific Freeform Property Set. At least one optional attribute is required. @@ -57,8 +57,8 @@ output "foo" {value = data.apstra_freeform_property_set.foo} ### Optional -- `id` (String) Populate this field to look up a Freeform Property Set by `id`. Required when `name` is omitted. -- `name` (String) Populate this field to look up an imported Property Set by `name`. Required when `id` is omitted. +- `id` (String) Populate this field to look up a Freeform Property Set by ID. Required when `name` is omitted. +- `name` (String) Populate this field to look up an imported Property Set by Name. Required when `id` is omitted. ### Read-Only diff --git a/docs/data-sources/freeform_system.md b/docs/data-sources/freeform_system.md new file mode 100644 index 00000000..ab710fac --- /dev/null +++ b/docs/data-sources/freeform_system.md @@ -0,0 +1,41 @@ +--- +page_title: "apstra_freeform_system Data Source - terraform-provider-apstra" +subcategory: "Reference Design: Freeform" +description: |- + This data source provides details of a specific Freeform System. + At least one optional attribute is required. +--- + +# apstra_freeform_system (Data Source) + +This data source provides details of a specific Freeform System. + +At least one optional attribute is required. + + +## Example Usage + +```terraform +# +``` + + +## Schema + +### Required + +- `blueprint_id` (String) Apstra Blueprint ID. Used to identify the Blueprint where the System lives. + +### Optional + +- `id` (String) Populate this field to look up the Freeform System by ID. Required when `name` is omitted. +- `name` (String) Populate this field to look up System by Name. Required when `id` is omitted. + +### Read-Only + +- `deploy_mode` (String) deploy mode of the System +- `device_profile_id` (String) device profile ID of the System +- `hostname` (String) Hostname of the System +- `system_id` (String) Device System ID assigned to the System +- `tags` (Set of String) Set of Tag labels +- `type` (String) type of the System, either Internal or External diff --git a/docs/resources/freeform_system.md b/docs/resources/freeform_system.md new file mode 100644 index 00000000..308c48b7 --- /dev/null +++ b/docs/resources/freeform_system.md @@ -0,0 +1,41 @@ +--- +page_title: "apstra_freeform_system Resource - terraform-provider-apstra" +subcategory: "Reference Design: Freeform" +description: |- + This resource creates a System in a Freeform Blueprint. +--- + +# apstra_freeform_system (Resource) + +This resource creates a System in a Freeform Blueprint. + + +## Example Usage + +```terraform +# +``` + + +## Schema + +### Required + +- `blueprint_id` (String) Apstra Blueprint ID. +- `name` (String) Freeform System name as shown in the Web UI. +- `type` (String) Type of the System. Must be one of `internal` or `external` + +### Optional + +- `deploy_mode` (String) Deploy mode of the System +- `device_profile_id` (String) Device profile ID of the System +- `hostname` (String) Hostname of the Freeform System. +- `system_id` (String) ID (usually serial number) of the Managed Device to associate with this System +- `tags` (Set of String) Set of Tag labels + +### Read-Only + +- `id` (String) ID of the Freeform System. + + + diff --git a/examples/data-sources/apstra_freeform_system/example.tf b/examples/data-sources/apstra_freeform_system/example.tf new file mode 100644 index 00000000..792d6005 --- /dev/null +++ b/examples/data-sources/apstra_freeform_system/example.tf @@ -0,0 +1 @@ +# diff --git a/examples/resources/apstra_freeform_system/example.tf b/examples/resources/apstra_freeform_system/example.tf new file mode 100644 index 00000000..792d6005 --- /dev/null +++ b/examples/resources/apstra_freeform_system/example.tf @@ -0,0 +1 @@ +# From 2e453a5d20c9880cb2e12588e3231c467cc38a05 Mon Sep 17 00:00:00 2001 From: Chris Marget Date: Tue, 2 Jul 2024 21:34:38 -0400 Subject: [PATCH 4/4] gofumpt --- apstra/blueprint/freeform_config_template.go | 3 ++- apstra/blueprint/freeform_property_set.go | 1 + apstra/blueprint/freeform_system.go | 1 + apstra/configure_resource.go | 1 + apstra/data_source_freeform_config_template.go | 7 +++++-- apstra/data_source_freeform_property_set.go | 8 ++++++-- apstra/data_source_freeform_system.go | 8 ++++++-- apstra/resource_freeform_config_template.go | 9 ++++++--- ...resource_freeform_config_template_integration_test.go | 7 ++++--- apstra/resource_freeform_property_set.go | 9 ++++++--- .../resource_freeform_property_set_integration_test.go | 3 ++- apstra/resource_freeform_system.go | 9 ++++++--- 12 files changed, 46 insertions(+), 20 deletions(-) diff --git a/apstra/blueprint/freeform_config_template.go b/apstra/blueprint/freeform_config_template.go index 14b4020a..14c28de8 100644 --- a/apstra/blueprint/freeform_config_template.go +++ b/apstra/blueprint/freeform_config_template.go @@ -2,6 +2,8 @@ package blueprint import ( "context" + "regexp" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" @@ -14,7 +16,6 @@ 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" - "regexp" ) type FreeformConfigTemplate struct { diff --git a/apstra/blueprint/freeform_property_set.go b/apstra/blueprint/freeform_property_set.go index e0038d1f..88085be1 100644 --- a/apstra/blueprint/freeform_property_set.go +++ b/apstra/blueprint/freeform_property_set.go @@ -3,6 +3,7 @@ package blueprint import ( "context" "encoding/json" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/hashicorp/terraform-plugin-framework-jsontypes/jsontypes" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" diff --git a/apstra/blueprint/freeform_system.go b/apstra/blueprint/freeform_system.go index f2c7ff7c..a0a6e1a8 100644 --- a/apstra/blueprint/freeform_system.go +++ b/apstra/blueprint/freeform_system.go @@ -3,6 +3,7 @@ package blueprint import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/utils" "github.com/hashicorp/terraform-plugin-framework-validators/setvalidator" diff --git a/apstra/configure_resource.go b/apstra/configure_resource.go index 4057df90..77b1d4f7 100644 --- a/apstra/configure_resource.go +++ b/apstra/configure_resource.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/hashicorp/terraform-plugin-framework/resource" ) diff --git a/apstra/data_source_freeform_config_template.go b/apstra/data_source_freeform_config_template.go index 654fa231..8be3437c 100644 --- a/apstra/data_source_freeform_config_template.go +++ b/apstra/data_source_freeform_config_template.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -12,8 +13,10 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ datasource.DataSourceWithConfigure = &dataSourceFreeformConfigTemplate{} -var _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformConfigTemplate{} +var ( + _ datasource.DataSourceWithConfigure = &dataSourceFreeformConfigTemplate{} + _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformConfigTemplate{} +) type dataSourceFreeformConfigTemplate struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error) diff --git a/apstra/data_source_freeform_property_set.go b/apstra/data_source_freeform_property_set.go index 19c47fbb..36a2f55b 100644 --- a/apstra/data_source_freeform_property_set.go +++ b/apstra/data_source_freeform_property_set.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -12,8 +13,10 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ datasource.DataSourceWithConfigure = &dataSourceFreeformPropertySet{} -var _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformPropertySet{} +var ( + _ datasource.DataSourceWithConfigure = &dataSourceFreeformPropertySet{} + _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformPropertySet{} +) type dataSourceFreeformPropertySet struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error) @@ -34,6 +37,7 @@ func (o *dataSourceFreeformPropertySet) Schema(_ context.Context, _ datasource.S Attributes: blueprint.FreeformPropertySet{}.DataSourceAttributes(), } } + func (o *dataSourceFreeformPropertySet) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config blueprint.FreeformPropertySet resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) diff --git a/apstra/data_source_freeform_system.go b/apstra/data_source_freeform_system.go index aeae02c0..3d7dd4fe 100644 --- a/apstra/data_source_freeform_system.go +++ b/apstra/data_source_freeform_system.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -12,8 +13,10 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ datasource.DataSourceWithConfigure = &dataSourceFreeformSystem{} -var _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformSystem{} +var ( + _ datasource.DataSourceWithConfigure = &dataSourceFreeformSystem{} + _ datasourceWithSetFfBpClientFunc = &dataSourceFreeformSystem{} +) type dataSourceFreeformSystem struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error) @@ -34,6 +37,7 @@ func (o *dataSourceFreeformSystem) Schema(_ context.Context, _ datasource.Schema Attributes: blueprint.FreeformSystem{}.DataSourceAttributes(), } } + func (o *dataSourceFreeformSystem) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { var config blueprint.FreeformSystem resp.Diagnostics.Append(req.Config.Get(ctx, &config)...) diff --git a/apstra/resource_freeform_config_template.go b/apstra/resource_freeform_config_template.go index 9878f686..6d04e02b 100644 --- a/apstra/resource_freeform_config_template.go +++ b/apstra/resource_freeform_config_template.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -11,9 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ resource.ResourceWithConfigure = &resourceFreeformConfigTemplate{} -var _ resourceWithSetFfBpClientFunc = &resourceFreeformConfigTemplate{} -var _ resourceWithSetBpLockFunc = &resourceFreeformConfigTemplate{} +var ( + _ resource.ResourceWithConfigure = &resourceFreeformConfigTemplate{} + _ resourceWithSetFfBpClientFunc = &resourceFreeformConfigTemplate{} + _ resourceWithSetBpLockFunc = &resourceFreeformConfigTemplate{} +) type resourceFreeformConfigTemplate struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error) diff --git a/apstra/resource_freeform_config_template_integration_test.go b/apstra/resource_freeform_config_template_integration_test.go index 9e941d50..220baeae 100644 --- a/apstra/resource_freeform_config_template_integration_test.go +++ b/apstra/resource_freeform_config_template_integration_test.go @@ -5,14 +5,15 @@ package tfapstra_test import ( "context" "fmt" + "math/rand" + "strconv" + "testing" + tfapstra "github.com/Juniper/terraform-provider-apstra/apstra" testutils "github.com/Juniper/terraform-provider-apstra/apstra/test_utils" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "math/rand" - "strconv" - "testing" ) const ( diff --git a/apstra/resource_freeform_property_set.go b/apstra/resource_freeform_property_set.go index 1ad39f56..7f6d4001 100644 --- a/apstra/resource_freeform_property_set.go +++ b/apstra/resource_freeform_property_set.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -11,9 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ resource.ResourceWithConfigure = &resourceFreeformPropertySet{} -var _ resourceWithSetFfBpClientFunc = &resourceFreeformPropertySet{} -var _ resourceWithSetBpLockFunc = &resourceFreeformPropertySet{} +var ( + _ resource.ResourceWithConfigure = &resourceFreeformPropertySet{} + _ resourceWithSetFfBpClientFunc = &resourceFreeformPropertySet{} + _ resourceWithSetBpLockFunc = &resourceFreeformPropertySet{} +) type resourceFreeformPropertySet struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error) diff --git a/apstra/resource_freeform_property_set_integration_test.go b/apstra/resource_freeform_property_set_integration_test.go index 9bff337d..4cd2898f 100644 --- a/apstra/resource_freeform_property_set_integration_test.go +++ b/apstra/resource_freeform_property_set_integration_test.go @@ -6,12 +6,13 @@ import ( "context" "encoding/json" "fmt" + "testing" + tfapstra "github.com/Juniper/terraform-provider-apstra/apstra" testutils "github.com/Juniper/terraform-provider-apstra/apstra/test_utils" "github.com/hashicorp/go-version" "github.com/hashicorp/terraform-plugin-testing/helper/acctest" "github.com/hashicorp/terraform-plugin-testing/helper/resource" - "testing" ) const ( diff --git a/apstra/resource_freeform_system.go b/apstra/resource_freeform_system.go index 0e36e620..3eef0c42 100644 --- a/apstra/resource_freeform_system.go +++ b/apstra/resource_freeform_system.go @@ -3,6 +3,7 @@ package tfapstra import ( "context" "fmt" + "github.com/Juniper/apstra-go-sdk/apstra" "github.com/Juniper/terraform-provider-apstra/apstra/blueprint" "github.com/Juniper/terraform-provider-apstra/apstra/utils" @@ -11,9 +12,11 @@ import ( "github.com/hashicorp/terraform-plugin-framework/types" ) -var _ resource.ResourceWithConfigure = &resourceFreeformSystem{} -var _ resourceWithSetFfBpClientFunc = &resourceFreeformSystem{} -var _ resourceWithSetBpLockFunc = &resourceFreeformSystem{} +var ( + _ resource.ResourceWithConfigure = &resourceFreeformSystem{} + _ resourceWithSetFfBpClientFunc = &resourceFreeformSystem{} + _ resourceWithSetBpLockFunc = &resourceFreeformSystem{} +) type resourceFreeformSystem struct { getBpClientFunc func(context.Context, string) (*apstra.FreeformClient, error)