From da889c655f994a0dfc7e798370450471ff5d9743 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Thu, 29 Aug 2024 15:03:05 -0700 Subject: [PATCH 01/11] feat: adding fabric market place subscription data source --- equinix/provider.go | 66 +++++---- .../fabric/marketplace/datasources.go | 40 +++++ .../fabric/marketplace/datasources_schema.go | 139 ++++++++++++++++++ .../resources/fabric/marketplace/models.go | 98 ++++++++++++ 4 files changed, 311 insertions(+), 32 deletions(-) create mode 100644 internal/resources/fabric/marketplace/datasources.go create mode 100644 internal/resources/fabric/marketplace/datasources_schema.go create mode 100644 internal/resources/fabric/marketplace/models.go diff --git a/equinix/provider.go b/equinix/provider.go index 47043987a..24cc9645f 100644 --- a/equinix/provider.go +++ b/equinix/provider.go @@ -8,6 +8,7 @@ import ( "github.com/equinix/terraform-provider-equinix/internal/config" fabric_connection "github.com/equinix/terraform-provider-equinix/internal/resources/fabric/connection" + fabric_market_place_subscription "github.com/equinix/terraform-provider-equinix/internal/resources/fabric/marketplace" fabric_network "github.com/equinix/terraform-provider-equinix/internal/resources/fabric/network" metal_port "github.com/equinix/terraform-provider-equinix/internal/resources/metal/port" "github.com/equinix/terraform-provider-equinix/internal/resources/metal/virtual_circuit" @@ -79,38 +80,39 @@ func Provider() *schema.Provider { }, }, DataSourcesMap: map[string]*schema.Resource{ - "equinix_fabric_routing_protocol": dataSourceRoutingProtocol(), - "equinix_fabric_connection": fabric_connection.DataSource(), - "equinix_fabric_connections": fabric_connection.DataSourceSearch(), - "equinix_fabric_cloud_router": dataSourceFabricCloudRouter(), - "equinix_fabric_cloud_routers": dataSourceFabricGetCloudRouters(), - "equinix_fabric_network": fabric_network.DataSource(), - "equinix_fabric_networks": fabric_network.DataSourceSearch(), - "equinix_fabric_port": dataSourceFabricPort(), - "equinix_fabric_ports": dataSourceFabricGetPortsByName(), - "equinix_fabric_service_profile": dataSourceFabricServiceProfileReadByUuid(), - "equinix_fabric_service_profiles": dataSourceFabricSearchServiceProfilesByName(), - "equinix_network_account": dataSourceNetworkAccount(), - "equinix_network_device": dataSourceNetworkDevice(), - "equinix_network_device_type": dataSourceNetworkDeviceType(), - "equinix_network_device_software": dataSourceNetworkDeviceSoftware(), - "equinix_network_device_platform": dataSourceNetworkDevicePlatform(), - "equinix_metal_hardware_reservation": dataSourceMetalHardwareReservation(), - "equinix_metal_metro": dataSourceMetalMetro(), - "equinix_metal_facility": dataSourceMetalFacility(), - "equinix_metal_ip_block_ranges": dataSourceMetalIPBlockRanges(), - "equinix_metal_precreated_ip_block": dataSourceMetalPreCreatedIPBlock(), - "equinix_metal_operating_system": dataSourceOperatingSystem(), - "equinix_metal_spot_market_price": dataSourceSpotMarketPrice(), - "equinix_metal_device": dataSourceMetalDevice(), - "equinix_metal_devices": dataSourceMetalDevices(), - "equinix_metal_device_bgp_neighbors": dataSourceMetalDeviceBGPNeighbors(), - "equinix_metal_plans": dataSourceMetalPlans(), - "equinix_metal_port": metal_port.DataSource(), - "equinix_metal_reserved_ip_block": dataSourceMetalReservedIPBlock(), - "equinix_metal_spot_market_request": dataSourceMetalSpotMarketRequest(), - "equinix_metal_virtual_circuit": virtual_circuit.DataSource(), - "equinix_metal_vrf": vrf.DataSource(), + "equinix_fabric_routing_protocol": dataSourceRoutingProtocol(), + "equinix_fabric_connection": fabric_connection.DataSource(), + "equinix_fabric_connections": fabric_connection.DataSourceSearch(), + "equinix_fabric_cloud_router": dataSourceFabricCloudRouter(), + "equinix_fabric_cloud_routers": dataSourceFabricGetCloudRouters(), + "equinix_fabric_market_place_subscription": fabric_market_place_subscription.DataSourceFabricMarketplaceSubscription(), + "equinix_fabric_network": fabric_network.DataSource(), + "equinix_fabric_networks": fabric_network.DataSourceSearch(), + "equinix_fabric_port": dataSourceFabricPort(), + "equinix_fabric_ports": dataSourceFabricGetPortsByName(), + "equinix_fabric_service_profile": dataSourceFabricServiceProfileReadByUuid(), + "equinix_fabric_service_profiles": dataSourceFabricSearchServiceProfilesByName(), + "equinix_network_account": dataSourceNetworkAccount(), + "equinix_network_device": dataSourceNetworkDevice(), + "equinix_network_device_type": dataSourceNetworkDeviceType(), + "equinix_network_device_software": dataSourceNetworkDeviceSoftware(), + "equinix_network_device_platform": dataSourceNetworkDevicePlatform(), + "equinix_metal_hardware_reservation": dataSourceMetalHardwareReservation(), + "equinix_metal_metro": dataSourceMetalMetro(), + "equinix_metal_facility": dataSourceMetalFacility(), + "equinix_metal_ip_block_ranges": dataSourceMetalIPBlockRanges(), + "equinix_metal_precreated_ip_block": dataSourceMetalPreCreatedIPBlock(), + "equinix_metal_operating_system": dataSourceOperatingSystem(), + "equinix_metal_spot_market_price": dataSourceSpotMarketPrice(), + "equinix_metal_device": dataSourceMetalDevice(), + "equinix_metal_devices": dataSourceMetalDevices(), + "equinix_metal_device_bgp_neighbors": dataSourceMetalDeviceBGPNeighbors(), + "equinix_metal_plans": dataSourceMetalPlans(), + "equinix_metal_port": metal_port.DataSource(), + "equinix_metal_reserved_ip_block": dataSourceMetalReservedIPBlock(), + "equinix_metal_spot_market_request": dataSourceMetalSpotMarketRequest(), + "equinix_metal_virtual_circuit": virtual_circuit.DataSource(), + "equinix_metal_vrf": vrf.DataSource(), }, ResourcesMap: map[string]*schema.Resource{ "equinix_fabric_network": fabric_network.Resource(), diff --git a/internal/resources/fabric/marketplace/datasources.go b/internal/resources/fabric/marketplace/datasources.go new file mode 100644 index 000000000..820de733d --- /dev/null +++ b/internal/resources/fabric/marketplace/datasources.go @@ -0,0 +1,40 @@ +package marketplace + +import ( + "context" + "log" + "strings" + + "github.com/equinix/terraform-provider-equinix/internal/config" + equinix_errors "github.com/equinix/terraform-provider-equinix/internal/errors" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func DataSourceFabricMarketplaceSubscription() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceFabricMarketplaceSubscriptionRead, + Schema: fabricMarketplaceSubscriptionDataSourceSchema(), + Description: "Fabric V4 API compatible data resource that allow user to fetch Marketplace Subscription detail for a given UUID", + } +} + +func dataSourceFabricMarketplaceSubscriptionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + uuid, _ := d.Get("uuid").(string) + d.SetId(uuid) + return fabricMarketplaceSubscriptionRead(ctx, d, meta) +} + +func fabricMarketplaceSubscriptionRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + client := meta.(*config.Config).NewFabricClientForSDK(d) + subscription, _, err := client.MarketplaceSubscriptionsApi.GetSubscriptionById(ctx, d.Id()).Execute() + if err != nil { + log.Printf("[WARN] Subscription %s not found , error %s", d.Id(), err) + if !strings.Contains(err.Error(), "500") { + d.SetId("") + } + return diag.FromErr(equinix_errors.FormatFabricError(err)) + } + d.SetId(subscription.GetUuid()) + return setFabricMap(d, subscription) +} diff --git a/internal/resources/fabric/marketplace/datasources_schema.go b/internal/resources/fabric/marketplace/datasources_schema.go new file mode 100644 index 000000000..4332bf855 --- /dev/null +++ b/internal/resources/fabric/marketplace/datasources_schema.go @@ -0,0 +1,139 @@ +package marketplace + +import ( + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func fabricMarketplaceSubscriptionDataSourceSchema() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "href": { + Type: schema.TypeString, + Computed: true, + Description: "Subscription URI information", + }, + "uuid": { + Type: schema.TypeString, + Required: true, + Description: "Equinix-assigned marketplace identifier", + }, + "status": { + Type: schema.TypeString, + Computed: true, + Description: "Subscription Status like; ACTIVE, EXPIRED, CANCELLED, GRACE_PERIOD", + }, + "marketplace": { + Type: schema.TypeString, + Computed: true, + Description: "Marketplace like; AWS, GCP, AZURE, REDHAT", + }, + "offer_type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Marketplace Offer Type like; PUBLIC, PRIVATE_OFFER", + }, + "is_auto_renew": { + Type: schema.TypeBool, + Optional: true, + Computed: true, + Description: "Information about subscription auto renewal", + }, + "trial": { + Type: schema.TypeSet, + Optional: true, + Description: "Subscription Trial", + MaxItems: 1, + Elem: &schema.Resource{ + Schema: marketplaceSubscriptionTrialSch(), + }, + }, + "entitlements": { + Type: schema.TypeList, + Optional: true, + Description: "Subscription entitlements", + Elem: &schema.Resource{ + Schema: marketplaceSubscriptionEntitlementsSch(), + }, + }, + } +} + +func marketplaceSubscriptionTrialSch() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + Optional: true, + Description: "Marketplace Subscription Trial Enabled", + }, + } +} + +func marketplaceSubscriptionEntitlementsSch() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "uuid": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Subscription Entitlement Id", + }, + "quantity_entitled": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Entitled Quantity", + }, + "quantity_consumed": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Consumed Quantity", + }, + "quantity_available": { + Type: schema.TypeInt, + Optional: true, + Computed: true, + Description: "Available Quantity", + }, + "asset": { + Type: schema.TypeSet, + Optional: true, + Computed: true, + Description: "Asset information", + MaxItems: 1, + Elem: &schema.Resource{ + Schema: marketplaceSubscriptionAssetSch(), + }, + }, + } +} + +func marketplaceSubscriptionAssetSch() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Defines the FCR type like; XF_ROUTER", + }, + "package": { + Type: schema.TypeSet, + Required: true, + Description: "Fabric Cloud Router Package Type", + MaxItems: 1, + Elem: &schema.Resource{ + Schema: marketplaceSubscriptionPackageSch(), + }, + }, + } +} +func marketplaceSubscriptionPackageSch() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Optional: true, + Computed: true, + Description: "Cloud Router package code", + }, + } +} diff --git a/internal/resources/fabric/marketplace/models.go b/internal/resources/fabric/marketplace/models.go new file mode 100644 index 000000000..d3de60133 --- /dev/null +++ b/internal/resources/fabric/marketplace/models.go @@ -0,0 +1,98 @@ +package marketplace + +import ( + "github.com/equinix/equinix-sdk-go/services/fabricv4" + equinix_schema "github.com/equinix/terraform-provider-equinix/internal/schema" + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" +) + +func setFabricMap(d *schema.ResourceData, subs *fabricv4.SubscriptionResponse) diag.Diagnostics { + diags := diag.Diagnostics{} + marketplaceSubscription := subscriptionMap(subs) + err := equinix_schema.SetMap(d, marketplaceSubscription) + if err != nil { + return diag.FromErr(err) + } + return diags +} + +func subscriptionMap(subs *fabricv4.SubscriptionResponse) map[string]interface{} { + subscription := make(map[string]interface{}) + subscription["href"] = subs.GetHref() + subscription["uuid"] = subs.GetUuid() + subscription["status"] = subs.GetStatus() + subscription["marketplace"] = subs.GetMarketplace() + subscription["offer_type"] = subs.GetOfferType() + subscription["is_auto_renew"] = subs.GetIsAutoRenew() + if subs.Trial != nil { + trial := subs.GetTrial() + subscription["trial"] = subscriptionTrialGoToTerraform(&trial) + } + if subs.Entitlements != nil { + entitlements := subs.GetEntitlements() + subscription["entitlements"] = subscriptionEntitlementsGoToTerraform(entitlements) + } + return subscription +} + +func subscriptionTrialGoToTerraform(trial *fabricv4.SubscriptionTrial) *schema.Set { + if trial == nil { + return nil + } + mappedTrial := make(map[string]interface{}) + mappedTrial["enabled"] = trial.GetEnabled() + trialSet := schema.NewSet( + schema.HashResource(&schema.Resource{ + Schema: marketplaceSubscriptionTrialSch()}), + []interface{}{mappedTrial}, + ) + return trialSet +} + +func subscriptionEntitlementsGoToTerraform(entitlementsList []fabricv4.SubscriptionEntitlementResponse) []map[string]interface{} { + if entitlementsList == nil { + return nil + } + mappedEntitlements := make([]map[string]interface{}, len(entitlementsList)) + for index, entitlements := range entitlementsList { + asset := entitlements.GetAsset() + mappedEntitlements[index] = map[string]interface{}{ + "uuid": entitlements.GetUuid(), + "quantity_entitled": entitlements.GetQuantityEntitled(), + "quantity_consumed": entitlements.GetQuantityConsumed(), + "asset": subscriptionAssetGoToTerraform(&asset), + } + } + return mappedEntitlements +} + +func subscriptionAssetGoToTerraform(asset *fabricv4.SubscriptionAsset) *schema.Set { + if asset == nil { + return nil + } + mappedAsset := make(map[string]interface{}) + mappedAsset["type"] = string(asset.GetType()) + package_ := asset.GetPackage() + mappedAsset["package"] = subscriptionPackageGoToTerraform(&package_) + assetSet := schema.NewSet( + schema.HashResource(&schema.Resource{ + Schema: marketplaceSubscriptionAssetSch()}), + []interface{}{mappedAsset}, + ) + return assetSet +} + +func subscriptionPackageGoToTerraform(package_ *fabricv4.SubscriptionRouterPackageType) *schema.Set { + if package_ == nil { + return nil + } + mappedPackage := make(map[string]interface{}) + mappedPackage["code"] = string(package_.GetCode()) + packageSet := schema.NewSet( + schema.HashResource(&schema.Resource{ + Schema: marketplaceSubscriptionPackageSch()}), + []interface{}{mappedPackage}, + ) + return packageSet +} From 5cc791292dcc98abb74df2aeb838dfd2bb0f9f2e Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Tue, 10 Sep 2024 11:02:39 -0700 Subject: [PATCH 02/11] feat: Adding docs for fabric marketplace data source --- .../fabric_market_place_subscription.md | 90 +++++++++++++++++++ .../data-source.tf | 18 ++++ 2 files changed, 108 insertions(+) create mode 100644 docs/data-sources/fabric_market_place_subscription.md create mode 100644 examples/data-sources/equinix_fabric_market_place_subscription/data-source.tf diff --git a/docs/data-sources/fabric_market_place_subscription.md b/docs/data-sources/fabric_market_place_subscription.md new file mode 100644 index 000000000..8fb4fa362 --- /dev/null +++ b/docs/data-sources/fabric_market_place_subscription.md @@ -0,0 +1,90 @@ +--- +subcategory: "Fabric" +--- + +# equinix_fabric_market_place_subscription (Data Source) + +Fabric V4 API compatible data resource that allow user to fetch Marketplace Subscription detail for a given UUID + +## Example Usage + +```terraform +data "equinix_fabric_market_place_subscription" "subscription-test" { + uuid = "" +} +output "id" { + value = data.equinix_fabric_market_place_subscription.subscription-test.id +} +output "status" { + value = data.equinix_fabric_market_place_subscription.subscription-test.status +} +output "marketplace" { + value = data.equinix_fabric_market_place_subscription.subscription-test.marketplace +} +output "offer_type" { + value = data.equinix_fabric_market_place_subscription.subscription-test.offer_type +} +output "is_auto_renew" { + value = data.equinix_fabric_market_place_subscription.subscription-test.is_auto_renew +} +``` + + +## Schema + +### Required + +- `uuid` (String) Equinix-assigned marketplace identifier + +### Optional + +- `entitlements` (Block List) Subscription entitlements (see [below for nested schema](#nestedblock--entitlements)) +- `is_auto_renew` (Boolean) Information about subscription auto renewal +- `offer_type` (String) Marketplace Offer Type like; PUBLIC, PRIVATE_OFFER +- `trial` (Block Set, Max: 1) Subscription Trial (see [below for nested schema](#nestedblock--trial)) + +### Read-Only + +- `href` (String) Subscription URI information +- `id` (String) The ID of this resource. +- `marketplace` (String) Marketplace like; AWS, GCP, AZURE, REDHAT +- `status` (String) Subscription Status like; ACTIVE, EXPIRED, CANCELLED, GRACE_PERIOD + + +### Nested Schema for `entitlements` + +Optional: + +- `asset` (Block Set, Max: 1) Asset information (see [below for nested schema](#nestedblock--entitlements--asset)) +- `quantity_available` (Number) Available Quantity +- `quantity_consumed` (Number) Consumed Quantity +- `quantity_entitled` (Number) Entitled Quantity +- `uuid` (String) Subscription Entitlement Id + + +### Nested Schema for `entitlements.asset` + +Required: + +- `package` (Block Set, Min: 1, Max: 1) Fabric Cloud Router Package Type (see [below for nested schema](#nestedblock--entitlements--asset--package)) + +Optional: + +- `type` (String) Defines the FCR type like; XF_ROUTER + + +### Nested Schema for `entitlements.asset.package` + +Optional: + +- `code` (String) Cloud Router package code + + + + + +### Nested Schema for `trial` + +Optional: + +- `enabled` (Boolean) Marketplace Subscription Trial Enabled diff --git a/examples/data-sources/equinix_fabric_market_place_subscription/data-source.tf b/examples/data-sources/equinix_fabric_market_place_subscription/data-source.tf new file mode 100644 index 000000000..51f2638e3 --- /dev/null +++ b/examples/data-sources/equinix_fabric_market_place_subscription/data-source.tf @@ -0,0 +1,18 @@ +data "equinix_fabric_market_place_subscription" "subscription-test" { + uuid = "" +} +output "id" { + value = data.equinix_fabric_market_place_subscription.subscription-test.id +} +output "status" { + value = data.equinix_fabric_market_place_subscription.subscription-test.status +} +output "marketplace" { + value = data.equinix_fabric_market_place_subscription.subscription-test.marketplace +} +output "offer_type" { + value = data.equinix_fabric_market_place_subscription.subscription-test.offer_type +} +output "is_auto_renew" { + value = data.equinix_fabric_market_place_subscription.subscription-test.is_auto_renew +} From de5dafe9c6ef4a7e49f7f95a6d78120fda7614a2 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 10:56:52 -0700 Subject: [PATCH 03/11] feat: Adding Marketplace Data Source Acceptance Test --- internal/fabric/testing_helpers/env_data.go | 13 ++++++ .../fabric/marketplace/datasources_schema.go | 16 ++----- .../fabric/marketplace/datasources_test.go | 42 +++++++++++++++++++ 3 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 internal/resources/fabric/marketplace/datasources_test.go diff --git a/internal/fabric/testing_helpers/env_data.go b/internal/fabric/testing_helpers/env_data.go index 31d03099e..cd04d6404 100644 --- a/internal/fabric/testing_helpers/env_data.go +++ b/internal/fabric/testing_helpers/env_data.go @@ -15,6 +15,10 @@ const ( FabricConnectionsTestDataEnvVar = "TF_ACC_FABRIC_CONNECTIONS_TEST_DATA" ) +const ( + FabricSubscriptionEnvVar = "TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID" +) + type EnvPorts map[string]map[string][]fabricv4.PortResponse func GetFabricEnvPorts(t *testing.T) EnvPorts { @@ -34,3 +38,12 @@ func GetFabricEnvConnectionTestData(t *testing.T) map[string]map[string]string { } return connectionTestData } + +func GetFabricMarketPlaceSubscriptionId(t *testing.T) string { + var subscriptionId string + subscriptionJson := os.Getenv(FabricSubscriptionEnvVar) + if err := json.Unmarshal([]byte(subscriptionJson), &subscriptionId); subscriptionJson != "" && err != nil { + t.Fatalf("Failed reading market place subscription id from environment: %v, %s", err, subscriptionJson) + } + return subscriptionId +} diff --git a/internal/resources/fabric/marketplace/datasources_schema.go b/internal/resources/fabric/marketplace/datasources_schema.go index 4332bf855..7f091bc3d 100644 --- a/internal/resources/fabric/marketplace/datasources_schema.go +++ b/internal/resources/fabric/marketplace/datasources_schema.go @@ -28,19 +28,17 @@ func fabricMarketplaceSubscriptionDataSourceSchema() map[string]*schema.Schema { }, "offer_type": { Type: schema.TypeString, - Optional: true, Computed: true, Description: "Marketplace Offer Type like; PUBLIC, PRIVATE_OFFER", }, "is_auto_renew": { Type: schema.TypeBool, - Optional: true, Computed: true, Description: "Information about subscription auto renewal", }, "trial": { Type: schema.TypeSet, - Optional: true, + Computed: true, Description: "Subscription Trial", MaxItems: 1, Elem: &schema.Resource{ @@ -49,7 +47,7 @@ func fabricMarketplaceSubscriptionDataSourceSchema() map[string]*schema.Schema { }, "entitlements": { Type: schema.TypeList, - Optional: true, + Computed: true, Description: "Subscription entitlements", Elem: &schema.Resource{ Schema: marketplaceSubscriptionEntitlementsSch(), @@ -63,7 +61,6 @@ func marketplaceSubscriptionTrialSch() map[string]*schema.Schema { "enabled": { Type: schema.TypeBool, Computed: true, - Optional: true, Description: "Marketplace Subscription Trial Enabled", }, } @@ -73,31 +70,26 @@ func marketplaceSubscriptionEntitlementsSch() map[string]*schema.Schema { return map[string]*schema.Schema{ "uuid": { Type: schema.TypeString, - Optional: true, Computed: true, Description: "Subscription Entitlement Id", }, "quantity_entitled": { Type: schema.TypeInt, - Optional: true, Computed: true, Description: "Entitled Quantity", }, "quantity_consumed": { Type: schema.TypeInt, - Optional: true, Computed: true, Description: "Consumed Quantity", }, "quantity_available": { Type: schema.TypeInt, - Optional: true, Computed: true, Description: "Available Quantity", }, "asset": { Type: schema.TypeSet, - Optional: true, Computed: true, Description: "Asset information", MaxItems: 1, @@ -112,13 +104,12 @@ func marketplaceSubscriptionAssetSch() map[string]*schema.Schema { return map[string]*schema.Schema{ "type": { Type: schema.TypeString, - Optional: true, Computed: true, Description: "Defines the FCR type like; XF_ROUTER", }, "package": { Type: schema.TypeSet, - Required: true, + Computed: true, Description: "Fabric Cloud Router Package Type", MaxItems: 1, Elem: &schema.Resource{ @@ -131,7 +122,6 @@ func marketplaceSubscriptionPackageSch() map[string]*schema.Schema { return map[string]*schema.Schema{ "code": { Type: schema.TypeString, - Optional: true, Computed: true, Description: "Cloud Router package code", }, diff --git a/internal/resources/fabric/marketplace/datasources_test.go b/internal/resources/fabric/marketplace/datasources_test.go new file mode 100644 index 000000000..17cbfecd5 --- /dev/null +++ b/internal/resources/fabric/marketplace/datasources_test.go @@ -0,0 +1,42 @@ +package marketplace_test + +import ( + "fmt" + "github.com/equinix/terraform-provider-equinix/internal/acceptance" + "github.com/equinix/terraform-provider-equinix/internal/fabric/testing_helpers" + "github.com/hashicorp/terraform-plugin-testing/helper/resource" + _ "github.com/hashicorp/terraform-plugin-testing/terraform" + "log" + "testing" +) + +func TestAccFabricDataSourceConnection_MKTP(t *testing.T) { + susbcriptionId := testing_helpers.GetFabricMarketPlaceSubscriptionId(t) + resource.ParallelTest(t, resource.TestCase{ + PreCheck: func() { acceptance.TestAccPreCheck(t) }, + Providers: acceptance.TestAccProviders, + Steps: []resource.TestStep{ + { + Config: configGetMarketplaceSubscriptionResource_MKTP(susbcriptionId), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet( + "data.equinix_fabric_market_place_subscription.test", "uuid"), + resource.TestCheckResourceAttrSet("data.equinix_fabric_market_place_subscription.test", "href"), + resource.TestCheckResourceAttr("data.equinix_fabric_market_place_subscription.test", "status", "ACTIVE"), + resource.TestCheckResourceAttr("data.equinix_fabric_market_place_subscription.test", "marketplace", "AWS"), + resource.TestCheckResourceAttr("data.equinix_fabric_market_place_subscription.test", "offer_type", "PUBLIC"), + resource.TestCheckResourceAttr("data.equinix_fabric_market_place_subscription.test", "is_auto_renew", "false"), + ), + }, + }, + }) + +} +func configGetMarketplaceSubscriptionResource_MKTP(subscription_id string) string { + log.Printf("!! debugging") + return fmt.Sprintf(` + data "equinix_fabric_market_place_subscription" "test"{ + uuid = "%s" + } +`, subscription_id) +} From 564e46c6495806baa8532a11ff4aa5a9e7afac71 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 11:03:23 -0700 Subject: [PATCH 04/11] fix: Updating marketplace acceptance test name --- internal/resources/fabric/marketplace/datasources_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/resources/fabric/marketplace/datasources_test.go b/internal/resources/fabric/marketplace/datasources_test.go index 17cbfecd5..4fa313ba8 100644 --- a/internal/resources/fabric/marketplace/datasources_test.go +++ b/internal/resources/fabric/marketplace/datasources_test.go @@ -10,14 +10,14 @@ import ( "testing" ) -func TestAccFabricDataSourceConnection_MKTP(t *testing.T) { +func TestAccFabricDataSourceConnection_PFCR(t *testing.T) { susbcriptionId := testing_helpers.GetFabricMarketPlaceSubscriptionId(t) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.TestAccPreCheck(t) }, Providers: acceptance.TestAccProviders, Steps: []resource.TestStep{ { - Config: configGetMarketplaceSubscriptionResource_MKTP(susbcriptionId), + Config: configGetMarketplaceSubscriptionResource(susbcriptionId), Check: resource.ComposeTestCheckFunc( resource.TestCheckResourceAttrSet( "data.equinix_fabric_market_place_subscription.test", "uuid"), @@ -32,7 +32,7 @@ func TestAccFabricDataSourceConnection_MKTP(t *testing.T) { }) } -func configGetMarketplaceSubscriptionResource_MKTP(subscription_id string) string { +func configGetMarketplaceSubscriptionResource(subscription_id string) string { log.Printf("!! debugging") return fmt.Sprintf(` data "equinix_fabric_market_place_subscription" "test"{ From 4d7c8ea82cab35d7df73e05776ac669fb6e9f7c1 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 11:43:10 -0700 Subject: [PATCH 05/11] fix: Updating acc test --- internal/resources/fabric/marketplace/datasources_schema.go | 3 --- internal/resources/fabric/marketplace/datasources_test.go | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/internal/resources/fabric/marketplace/datasources_schema.go b/internal/resources/fabric/marketplace/datasources_schema.go index 7f091bc3d..573b275da 100644 --- a/internal/resources/fabric/marketplace/datasources_schema.go +++ b/internal/resources/fabric/marketplace/datasources_schema.go @@ -40,7 +40,6 @@ func fabricMarketplaceSubscriptionDataSourceSchema() map[string]*schema.Schema { Type: schema.TypeSet, Computed: true, Description: "Subscription Trial", - MaxItems: 1, Elem: &schema.Resource{ Schema: marketplaceSubscriptionTrialSch(), }, @@ -92,7 +91,6 @@ func marketplaceSubscriptionEntitlementsSch() map[string]*schema.Schema { Type: schema.TypeSet, Computed: true, Description: "Asset information", - MaxItems: 1, Elem: &schema.Resource{ Schema: marketplaceSubscriptionAssetSch(), }, @@ -111,7 +109,6 @@ func marketplaceSubscriptionAssetSch() map[string]*schema.Schema { Type: schema.TypeSet, Computed: true, Description: "Fabric Cloud Router Package Type", - MaxItems: 1, Elem: &schema.Resource{ Schema: marketplaceSubscriptionPackageSch(), }, diff --git a/internal/resources/fabric/marketplace/datasources_test.go b/internal/resources/fabric/marketplace/datasources_test.go index 4fa313ba8..d4350d4dd 100644 --- a/internal/resources/fabric/marketplace/datasources_test.go +++ b/internal/resources/fabric/marketplace/datasources_test.go @@ -10,7 +10,7 @@ import ( "testing" ) -func TestAccFabricDataSourceConnection_PFCR(t *testing.T) { +func TestAccFabricDataSourceMarketPlace_PFCR(t *testing.T) { susbcriptionId := testing_helpers.GetFabricMarketPlaceSubscriptionId(t) resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { acceptance.TestAccPreCheck(t) }, From 51b3151ffb960889f18788673fbbfb18b578f981 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 12:03:32 -0700 Subject: [PATCH 06/11] fix:doc changes --- .../fabric_market_place_subscription.md | 48 ++++++++----------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/docs/data-sources/fabric_market_place_subscription.md b/docs/data-sources/fabric_market_place_subscription.md index 8fb4fa362..32d7ef5d8 100644 --- a/docs/data-sources/fabric_market_place_subscription.md +++ b/docs/data-sources/fabric_market_place_subscription.md @@ -36,55 +36,49 @@ output "is_auto_renew" { - `uuid` (String) Equinix-assigned marketplace identifier -### Optional - -- `entitlements` (Block List) Subscription entitlements (see [below for nested schema](#nestedblock--entitlements)) -- `is_auto_renew` (Boolean) Information about subscription auto renewal -- `offer_type` (String) Marketplace Offer Type like; PUBLIC, PRIVATE_OFFER -- `trial` (Block Set, Max: 1) Subscription Trial (see [below for nested schema](#nestedblock--trial)) - ### Read-Only +- `entitlements` (List of Object) Subscription entitlements (see [below for nested schema](#nestedatt--entitlements)) - `href` (String) Subscription URI information - `id` (String) The ID of this resource. +- `is_auto_renew` (Boolean) Information about subscription auto renewal - `marketplace` (String) Marketplace like; AWS, GCP, AZURE, REDHAT +- `offer_type` (String) Marketplace Offer Type like; PUBLIC, PRIVATE_OFFER - `status` (String) Subscription Status like; ACTIVE, EXPIRED, CANCELLED, GRACE_PERIOD +- `trial` (Set of Object) Subscription Trial (see [below for nested schema](#nestedatt--trial)) - + ### Nested Schema for `entitlements` -Optional: +Read-Only: -- `asset` (Block Set, Max: 1) Asset information (see [below for nested schema](#nestedblock--entitlements--asset)) -- `quantity_available` (Number) Available Quantity -- `quantity_consumed` (Number) Consumed Quantity -- `quantity_entitled` (Number) Entitled Quantity -- `uuid` (String) Subscription Entitlement Id +- `asset` (Set of Object) (see [below for nested schema](#nestedobjatt--entitlements--asset)) +- `quantity_available` (Number) +- `quantity_consumed` (Number) +- `quantity_entitled` (Number) +- `uuid` (String) - + ### Nested Schema for `entitlements.asset` -Required: - -- `package` (Block Set, Min: 1, Max: 1) Fabric Cloud Router Package Type (see [below for nested schema](#nestedblock--entitlements--asset--package)) - -Optional: +Read-Only: -- `type` (String) Defines the FCR type like; XF_ROUTER +- `package` (Set of Object) (see [below for nested schema](#nestedobjatt--entitlements--asset--package)) +- `type` (String) - + ### Nested Schema for `entitlements.asset.package` -Optional: +Read-Only: -- `code` (String) Cloud Router package code +- `code` (String) - + ### Nested Schema for `trial` -Optional: +Read-Only: -- `enabled` (Boolean) Marketplace Subscription Trial Enabled +- `enabled` (Boolean) From 4cae1a5e009643c621884e0420cd66e3319f3983 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 12:33:18 -0700 Subject: [PATCH 07/11] fix:Updating env_data setup --- .github/workflows/fabric_acctest.yml | 1 + internal/fabric/testing_helpers/env_data.go | 7 +++---- internal/resources/fabric/marketplace/datasources_test.go | 5 ++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/fabric_acctest.yml b/.github/workflows/fabric_acctest.yml index 86ba9e6d7..da6c6f91e 100644 --- a/.github/workflows/fabric_acctest.yml +++ b/.github/workflows/fabric_acctest.yml @@ -180,6 +180,7 @@ jobs: TF_ACC: "1" TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }} TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }} + TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID: ${{ secrets.TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID }} EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PFCR }} EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PFCR }} METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} diff --git a/internal/fabric/testing_helpers/env_data.go b/internal/fabric/testing_helpers/env_data.go index cd04d6404..693e8bd51 100644 --- a/internal/fabric/testing_helpers/env_data.go +++ b/internal/fabric/testing_helpers/env_data.go @@ -40,10 +40,9 @@ func GetFabricEnvConnectionTestData(t *testing.T) map[string]map[string]string { } func GetFabricMarketPlaceSubscriptionId(t *testing.T) string { - var subscriptionId string - subscriptionJson := os.Getenv(FabricSubscriptionEnvVar) - if err := json.Unmarshal([]byte(subscriptionJson), &subscriptionId); subscriptionJson != "" && err != nil { - t.Fatalf("Failed reading market place subscription id from environment: %v, %s", err, subscriptionJson) + subscriptionId := os.Getenv(FabricSubscriptionEnvVar) + if subscriptionId == "" { + t.Fatalf("Failed reading market place subscription id from environment: %v", subscriptionId) } return subscriptionId } diff --git a/internal/resources/fabric/marketplace/datasources_test.go b/internal/resources/fabric/marketplace/datasources_test.go index d4350d4dd..b7093df79 100644 --- a/internal/resources/fabric/marketplace/datasources_test.go +++ b/internal/resources/fabric/marketplace/datasources_test.go @@ -2,12 +2,12 @@ package marketplace_test import ( "fmt" + "testing" + "github.com/equinix/terraform-provider-equinix/internal/acceptance" "github.com/equinix/terraform-provider-equinix/internal/fabric/testing_helpers" "github.com/hashicorp/terraform-plugin-testing/helper/resource" _ "github.com/hashicorp/terraform-plugin-testing/terraform" - "log" - "testing" ) func TestAccFabricDataSourceMarketPlace_PFCR(t *testing.T) { @@ -33,7 +33,6 @@ func TestAccFabricDataSourceMarketPlace_PFCR(t *testing.T) { } func configGetMarketplaceSubscriptionResource(subscription_id string) string { - log.Printf("!! debugging") return fmt.Sprintf(` data "equinix_fabric_market_place_subscription" "test"{ uuid = "%s" From ccb484722aef3dc0487e3ecbb65a6364f6659bfc Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 13:02:32 -0700 Subject: [PATCH 08/11] fix:Fixing lint erros --- .github/workflows/fabric_acctest.yml | 1 + internal/fabric/testing_helpers/env_data.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/fabric_acctest.yml b/.github/workflows/fabric_acctest.yml index da6c6f91e..76479ae4f 100644 --- a/.github/workflows/fabric_acctest.yml +++ b/.github/workflows/fabric_acctest.yml @@ -112,6 +112,7 @@ jobs: TF_ACC: "1" TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }} TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }} + TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID: ${{ secrets.TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID }} EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PNFV }} EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PNFV }} METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} diff --git a/internal/fabric/testing_helpers/env_data.go b/internal/fabric/testing_helpers/env_data.go index 693e8bd51..ab2075c97 100644 --- a/internal/fabric/testing_helpers/env_data.go +++ b/internal/fabric/testing_helpers/env_data.go @@ -2,9 +2,10 @@ package testing_helpers import ( "encoding/json" - "github.com/equinix/equinix-sdk-go/services/fabricv4" "os" "testing" + + "github.com/equinix/equinix-sdk-go/services/fabricv4" ) const ( From 7090b64bc7746d65b25ddf9029a7b5d2fb80e797 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Mon, 16 Sep 2024 23:22:35 -0700 Subject: [PATCH 09/11] fix: removing env variable for marketplace subscription from PNFV test --- .github/workflows/fabric_acctest.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/fabric_acctest.yml b/.github/workflows/fabric_acctest.yml index 76479ae4f..da6c6f91e 100644 --- a/.github/workflows/fabric_acctest.yml +++ b/.github/workflows/fabric_acctest.yml @@ -112,7 +112,6 @@ jobs: TF_ACC: "1" TF_ACC_FABRIC_CONNECTIONS_TEST_DATA: ${{ secrets.TF_ACC_FABRIC_CONNECTIONS_TEST_DATA }} TF_ACC_FABRIC_DEDICATED_PORTS: ${{ secrets.TF_ACC_FABRIC_DEDICATED_PORTS }} - TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID: ${{ secrets.TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID }} EQUINIX_API_CLIENTID: ${{ secrets.EQUINIX_API_CLIENTID_PNFV }} EQUINIX_API_CLIENTSECRET: ${{ secrets.EQUINIX_API_CLIENTSECRET_PNFV }} METAL_AUTH_TOKEN: ${{ secrets.METAL_AUTH_TOKEN }} From 0fa0ca5e02069c9ef03bdd341e416735626a16e5 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Tue, 17 Sep 2024 14:57:29 -0700 Subject: [PATCH 10/11] fix: Updating schema definition as per comment --- internal/fabric/testing_helpers/env_data.go | 10 +- .../fabric/marketplace/datasources_schema.go | 118 +++++++++--------- .../resources/fabric/marketplace/models.go | 9 +- 3 files changed, 64 insertions(+), 73 deletions(-) diff --git a/internal/fabric/testing_helpers/env_data.go b/internal/fabric/testing_helpers/env_data.go index ab2075c97..7325bdd8a 100644 --- a/internal/fabric/testing_helpers/env_data.go +++ b/internal/fabric/testing_helpers/env_data.go @@ -9,15 +9,9 @@ import ( ) const ( - FabricDedicatedPortEnvVar = "TF_ACC_FABRIC_DEDICATED_PORTS" -) - -const ( + FabricDedicatedPortEnvVar = "TF_ACC_FABRIC_DEDICATED_PORTS" FabricConnectionsTestDataEnvVar = "TF_ACC_FABRIC_CONNECTIONS_TEST_DATA" -) - -const ( - FabricSubscriptionEnvVar = "TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID" + FabricSubscriptionEnvVar = "TF_ACC_FABRIC_MARKET_PLACE_SUBSCRIPTION_ID" ) type EnvPorts map[string]map[string][]fabricv4.PortResponse diff --git a/internal/resources/fabric/marketplace/datasources_schema.go b/internal/resources/fabric/marketplace/datasources_schema.go index 573b275da..ada92a4ce 100644 --- a/internal/resources/fabric/marketplace/datasources_schema.go +++ b/internal/resources/fabric/marketplace/datasources_schema.go @@ -40,87 +40,87 @@ func fabricMarketplaceSubscriptionDataSourceSchema() map[string]*schema.Schema { Type: schema.TypeSet, Computed: true, Description: "Subscription Trial", - Elem: &schema.Resource{ - Schema: marketplaceSubscriptionTrialSch(), - }, + Elem: marketplaceSubscriptionTrialSch(), }, "entitlements": { Type: schema.TypeList, Computed: true, Description: "Subscription entitlements", - Elem: &schema.Resource{ - Schema: marketplaceSubscriptionEntitlementsSch(), - }, + Elem: marketplaceSubscriptionEntitlementsSch(), }, } } -func marketplaceSubscriptionTrialSch() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "enabled": { - Type: schema.TypeBool, - Computed: true, - Description: "Marketplace Subscription Trial Enabled", +func marketplaceSubscriptionTrialSch() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "enabled": { + Type: schema.TypeBool, + Computed: true, + Description: "Marketplace Subscription Trial Enabled", + }, }, } } -func marketplaceSubscriptionEntitlementsSch() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "uuid": { - Type: schema.TypeString, - Computed: true, - Description: "Subscription Entitlement Id", - }, - "quantity_entitled": { - Type: schema.TypeInt, - Computed: true, - Description: "Entitled Quantity", - }, - "quantity_consumed": { - Type: schema.TypeInt, - Computed: true, - Description: "Consumed Quantity", - }, - "quantity_available": { - Type: schema.TypeInt, - Computed: true, - Description: "Available Quantity", - }, - "asset": { - Type: schema.TypeSet, - Computed: true, - Description: "Asset information", - Elem: &schema.Resource{ - Schema: marketplaceSubscriptionAssetSch(), +func marketplaceSubscriptionEntitlementsSch() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "uuid": { + Type: schema.TypeString, + Computed: true, + Description: "Subscription Entitlement Id", + }, + "quantity_entitled": { + Type: schema.TypeInt, + Computed: true, + Description: "Entitled Quantity", + }, + "quantity_consumed": { + Type: schema.TypeInt, + Computed: true, + Description: "Consumed Quantity", + }, + "quantity_available": { + Type: schema.TypeInt, + Computed: true, + Description: "Available Quantity", + }, + "asset": { + Type: schema.TypeSet, + Computed: true, + Description: "Asset information", + Elem: marketplaceSubscriptionAssetSch(), }, }, } } -func marketplaceSubscriptionAssetSch() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "type": { - Type: schema.TypeString, - Computed: true, - Description: "Defines the FCR type like; XF_ROUTER", - }, - "package": { - Type: schema.TypeSet, - Computed: true, - Description: "Fabric Cloud Router Package Type", - Elem: &schema.Resource{ - Schema: marketplaceSubscriptionPackageSch(), +func marketplaceSubscriptionAssetSch() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: schema.TypeString, + Computed: true, + Description: "Defines the FCR type like; XF_ROUTER", + }, + "package": { + Type: schema.TypeSet, + Computed: true, + Description: "Fabric Cloud Router Package Type", + Elem: marketplaceSubscriptionPackageSch(), }, }, } } -func marketplaceSubscriptionPackageSch() map[string]*schema.Schema { - return map[string]*schema.Schema{ - "code": { - Type: schema.TypeString, - Computed: true, - Description: "Cloud Router package code", +func marketplaceSubscriptionPackageSch() *schema.Resource { + return &schema.Resource{ + Schema: map[string]*schema.Schema{ + "code": { + Type: schema.TypeString, + Computed: true, + Description: "Cloud Router package code", + }, }, } } diff --git a/internal/resources/fabric/marketplace/models.go b/internal/resources/fabric/marketplace/models.go index d3de60133..5e8c328d9 100644 --- a/internal/resources/fabric/marketplace/models.go +++ b/internal/resources/fabric/marketplace/models.go @@ -43,8 +43,7 @@ func subscriptionTrialGoToTerraform(trial *fabricv4.SubscriptionTrial) *schema.S mappedTrial := make(map[string]interface{}) mappedTrial["enabled"] = trial.GetEnabled() trialSet := schema.NewSet( - schema.HashResource(&schema.Resource{ - Schema: marketplaceSubscriptionTrialSch()}), + schema.HashResource(marketplaceSubscriptionTrialSch()), []interface{}{mappedTrial}, ) return trialSet @@ -76,8 +75,7 @@ func subscriptionAssetGoToTerraform(asset *fabricv4.SubscriptionAsset) *schema.S package_ := asset.GetPackage() mappedAsset["package"] = subscriptionPackageGoToTerraform(&package_) assetSet := schema.NewSet( - schema.HashResource(&schema.Resource{ - Schema: marketplaceSubscriptionAssetSch()}), + schema.HashResource(marketplaceSubscriptionAssetSch()), []interface{}{mappedAsset}, ) return assetSet @@ -90,8 +88,7 @@ func subscriptionPackageGoToTerraform(package_ *fabricv4.SubscriptionRouterPacka mappedPackage := make(map[string]interface{}) mappedPackage["code"] = string(package_.GetCode()) packageSet := schema.NewSet( - schema.HashResource(&schema.Resource{ - Schema: marketplaceSubscriptionPackageSch()}), + schema.HashResource(marketplaceSubscriptionPackageSch()), []interface{}{mappedPackage}, ) return packageSet From a82d0605904c622ba494361198a8e1dcbce6f6f4 Mon Sep 17 00:00:00 2001 From: srushti-patl Date: Wed, 18 Sep 2024 13:53:19 -0700 Subject: [PATCH 11/11] fix: Removing nil string check condition for subscription id --- internal/fabric/testing_helpers/env_data.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/internal/fabric/testing_helpers/env_data.go b/internal/fabric/testing_helpers/env_data.go index 7325bdd8a..b0c02ed87 100644 --- a/internal/fabric/testing_helpers/env_data.go +++ b/internal/fabric/testing_helpers/env_data.go @@ -36,8 +36,5 @@ func GetFabricEnvConnectionTestData(t *testing.T) map[string]map[string]string { func GetFabricMarketPlaceSubscriptionId(t *testing.T) string { subscriptionId := os.Getenv(FabricSubscriptionEnvVar) - if subscriptionId == "" { - t.Fatalf("Failed reading market place subscription id from environment: %v", subscriptionId) - } return subscriptionId }