From 81f2a3bf775b2e2eaab7ea5c56d6e8fe86fdf839 Mon Sep 17 00:00:00 2001 From: Craig Squire <677724+csquire@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:11:37 -0600 Subject: [PATCH 1/3] chore: Migrate license map resource from SDKv2 to plugin framework --- pkg/framework/objects/group/resource.go | 3 +- pkg/framework/objects/license_map/model.go | 11 + pkg/framework/objects/license_map/resource.go | 240 ++++++++++++++++++ .../license_map/resource_acceptance_test.go} | 4 +- pkg/framework/objects/license_map/schema.go | 42 +++ .../objects/oauth_configuration/resource.go | 3 +- .../objects/partial_license_map/model.go | 10 +- .../objects/partial_license_map/resource.go | 9 +- pkg/provider/framework_provider.go | 5 +- pkg/provider/sdk_provider.go | 1 - pkg/sdkv2/resources/license_map.go | 157 ------------ 11 files changed, 308 insertions(+), 177 deletions(-) create mode 100644 pkg/framework/objects/license_map/model.go create mode 100644 pkg/framework/objects/license_map/resource.go rename pkg/{sdkv2/resources/license_map_acceptance_test.go => framework/objects/license_map/resource_acceptance_test.go} (97%) create mode 100644 pkg/framework/objects/license_map/schema.go delete mode 100644 pkg/sdkv2/resources/license_map.go diff --git a/pkg/framework/objects/group/resource.go b/pkg/framework/objects/group/resource.go index 1548b14b..d78bccdb 100644 --- a/pkg/framework/objects/group/resource.go +++ b/pkg/framework/objects/group/resource.go @@ -2,7 +2,6 @@ package group import ( "context" - "fmt" "strconv" "strings" @@ -263,7 +262,7 @@ func (r *groupResource) ImportState( groupIDStr := req.ID groupID, err := strconv.Atoi(groupIDStr) if err != nil { - fmt.Println(err) + resp.Diagnostics.AddError("Error parsing group ID for import", err.Error()) return } diff --git a/pkg/framework/objects/license_map/model.go b/pkg/framework/objects/license_map/model.go new file mode 100644 index 00000000..b5b581a7 --- /dev/null +++ b/pkg/framework/objects/license_map/model.go @@ -0,0 +1,11 @@ +package license_map + +import ( + "github.com/hashicorp/terraform-plugin-framework/types" +) + +type LicenseMapResourceModel struct { + ID types.Int64 `tfsdk:"id"` + LicenseType types.String `tfsdk:"license_type"` + SSOLicenseMappingGroups types.Set `tfsdk:"sso_license_mapping_groups"` +} diff --git a/pkg/framework/objects/license_map/resource.go b/pkg/framework/objects/license_map/resource.go new file mode 100644 index 00000000..d8f6cc93 --- /dev/null +++ b/pkg/framework/objects/license_map/resource.go @@ -0,0 +1,240 @@ +package license_map + +import ( + "context" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/helper" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/types" + "github.com/samber/lo" + "strconv" + "strings" +) + +var ( + _ resource.Resource = &licenseMapResource{} + _ resource.ResourceWithConfigure = &licenseMapResource{} + + licenseTypes = []string{ + "developer", + "read_only", + "it", + } +) + +func LicenseMapResource() resource.Resource { + return &licenseMapResource{} +} + +type licenseMapResource struct { + client *dbt_cloud.Client +} + +func (r *licenseMapResource) Metadata( + _ context.Context, + req resource.MetadataRequest, + resp *resource.MetadataResponse, +) { + resp.TypeName = req.ProviderTypeName + "_license_map" +} + +func (r *licenseMapResource) Read( + ctx context.Context, + req resource.ReadRequest, + resp *resource.ReadResponse, +) { + var state LicenseMapResourceModel + + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + + licenseMapID := state.ID.ValueInt64() + licenseMap, err := r.client.GetLicenseMap(int(licenseMapID)) + if err != nil { + if strings.HasPrefix(err.Error(), "resource-not-found") { + resp.Diagnostics.AddWarning( + "Resource not found", + "The license map resource was not found and has been removed from the state.", + ) + resp.State.RemoveResource(ctx) + return + } + resp.Diagnostics.AddError("Error getting the license map", err.Error()) + return + } + + state.ID = types.Int64Value(int64(*licenseMap.ID)) + state.LicenseType = types.StringValue(licenseMap.LicenseType) + state.SSOLicenseMappingGroups, _ = types.SetValueFrom( + context.Background(), + types.StringType, + licenseMap.SSOLicenseMappingGroups, + ) + + resp.Diagnostics.Append(resp.State.Set(ctx, &state)...) +} + +func (r *licenseMapResource) Create( + ctx context.Context, + req resource.CreateRequest, + resp *resource.CreateResponse, +) { + var plan LicenseMapResourceModel + + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + if resp.Diagnostics.HasError() { + return + } + + var configSsoMapping []string + diags := plan.SSOLicenseMappingGroups.ElementsAs( + context.Background(), + &configSsoMapping, + false, + ) + if diags.HasError() { + resp.Diagnostics.AddError("Error extracting the list of SSO groups", "") + return + } + + licenseMap, err := r.client.CreateLicenseMap( + plan.LicenseType.ValueString(), + configSsoMapping, + ) + + if err != nil { + resp.Diagnostics.AddError( + "Unable to create license map", + "Error: "+err.Error(), + ) + return + } + + plan.ID = types.Int64PointerValue(helper.IntPointerToInt64Pointer(licenseMap.ID)) + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +func (r *licenseMapResource) Delete( + ctx context.Context, + req resource.DeleteRequest, + resp *resource.DeleteResponse, +) { + var state LicenseMapResourceModel + + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + licenseMapID := int(state.ID.ValueInt64()) + + err := r.client.DestroyLicenseMap(licenseMapID) + if err != nil { + resp.Diagnostics.AddError("Error deleting the license map", err.Error()) + return + } +} + +func (r *licenseMapResource) Update( + ctx context.Context, + req resource.UpdateRequest, + resp *resource.UpdateResponse, +) { + var plan, state LicenseMapResourceModel + + resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) + resp.Diagnostics.Append(req.State.Get(ctx, &state)...) + if resp.Diagnostics.HasError() { + return + } + + licenseMapID := int(state.ID.ValueInt64()) + licenseMap, err := r.client.GetLicenseMap(licenseMapID) + if err != nil { + resp.Diagnostics.AddError( + "Error getting the license map", + "Error: "+err.Error(), + ) + return + } + + var planSsoMapping []string + diags := plan.SSOLicenseMappingGroups.ElementsAs( + context.Background(), + &planSsoMapping, + false, + ) + if diags.HasError() { + resp.Diagnostics.AddError("Error extracting the list of SSO groups from the plan", "") + return + } + + var stateSsoMapping []string + diags = state.SSOLicenseMappingGroups.ElementsAs( + context.Background(), + &stateSsoMapping, + false, + ) + if diags.HasError() { + resp.Diagnostics.AddError("Error extracting the list of SSO groups from the state", "") + return + } + + deletedSsoMapping, newSsoMapping := lo.Difference(stateSsoMapping, planSsoMapping) + hasMappingChanges := len(deletedSsoMapping) > 0 || len(newSsoMapping) > 0 + + if state.LicenseType != plan.LicenseType || hasMappingChanges { + if state.LicenseType != plan.LicenseType { + licenseMap.LicenseType = plan.LicenseType.ValueString() + } + + if hasMappingChanges { + licenseMap.SSOLicenseMappingGroups = planSsoMapping + } + + _, err = r.client.UpdateLicenseMap(licenseMapID, *licenseMap) + if err != nil { + resp.Diagnostics.AddError( + "Unable to update the existing license map", + "Error: "+err.Error(), + ) + return + } + } + + resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...) +} + +func (r *licenseMapResource) ImportState( + ctx context.Context, + req resource.ImportStateRequest, + resp *resource.ImportStateResponse, +) { + licenseMapID, err := strconv.Atoi(req.ID) + if err != nil { + resp.Diagnostics.AddError("Error parsing license map ID for import", err.Error()) + return + } + ssoLicenseMappingGroups, _ := types.SetValue(types.StringType, nil) + state := LicenseMapResourceModel{ + ID: types.Int64Value(int64(licenseMapID)), + SSOLicenseMappingGroups: ssoLicenseMappingGroups, + } + + diags := resp.State.Set(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } +} + +func (r *licenseMapResource) Configure( + _ context.Context, + req resource.ConfigureRequest, + _ *resource.ConfigureResponse, +) { + if req.ProviderData == nil { + return + } + + r.client = req.ProviderData.(*dbt_cloud.Client) +} diff --git a/pkg/sdkv2/resources/license_map_acceptance_test.go b/pkg/framework/objects/license_map/resource_acceptance_test.go similarity index 97% rename from pkg/sdkv2/resources/license_map_acceptance_test.go rename to pkg/framework/objects/license_map/resource_acceptance_test.go index 228a5e84..969b1902 100644 --- a/pkg/sdkv2/resources/license_map_acceptance_test.go +++ b/pkg/framework/objects/license_map/resource_acceptance_test.go @@ -1,4 +1,4 @@ -package resources_test +package license_map_test import ( "fmt" @@ -18,7 +18,7 @@ func TestAccDbtCloudLicenseMapResource(t *testing.T) { groupName2 := acctest.RandStringFromCharSet(10, acctest.CharSetAlpha) resource.Test(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, + PreCheck: func() { acctest_helper.TestAccPreCheck(t) }, ProtoV6ProviderFactories: acctest_helper.TestAccProtoV6ProviderFactories, CheckDestroy: testAccCheckDbtCloudLicenseMapDestroy, Steps: []resource.TestStep{ diff --git a/pkg/framework/objects/license_map/schema.go b/pkg/framework/objects/license_map/schema.go new file mode 100644 index 00000000..b691596e --- /dev/null +++ b/pkg/framework/objects/license_map/schema.go @@ -0,0 +1,42 @@ +package license_map + +import ( + "context" + "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/int64planmodifier" + "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier" + "github.com/hashicorp/terraform-plugin-framework/schema/validator" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +func (r *licenseMapResource) Schema( + _ context.Context, + _ resource.SchemaRequest, + resp *resource.SchemaResponse, +) { + resp.Schema = schema.Schema{ + Attributes: map[string]schema.Attribute{ + "id": schema.Int64Attribute{ + Computed: true, + Description: "The ID of the license map", + PlanModifiers: []planmodifier.Int64{ + int64planmodifier.UseStateForUnknown(), + }, + }, + "license_type": schema.StringAttribute{ + Required: true, + Description: "License type", + Validators: []validator.String{ + stringvalidator.OneOf(licenseTypes...), + }, + }, + "sso_license_mapping_groups": schema.SetAttribute{ + Optional: true, + Description: "SSO license mapping group names for this group", + ElementType: types.StringType, + }, + }, + } +} diff --git a/pkg/framework/objects/oauth_configuration/resource.go b/pkg/framework/objects/oauth_configuration/resource.go index 81cfc896..1ef64e75 100644 --- a/pkg/framework/objects/oauth_configuration/resource.go +++ b/pkg/framework/objects/oauth_configuration/resource.go @@ -2,7 +2,6 @@ package oauth_configuration import ( "context" - "fmt" "strconv" "strings" @@ -267,7 +266,7 @@ func (r *oAuthConfigurationResource) ImportState( oAuthConfigurationIDStr := req.ID oAuthConfigurationID, err := strconv.Atoi(oAuthConfigurationIDStr) if err != nil { - fmt.Println(err) + resp.Diagnostics.AddError("Error parsing OAuth configuration ID for import", err.Error()) return } diff --git a/pkg/framework/objects/partial_license_map/model.go b/pkg/framework/objects/partial_license_map/model.go index 2a6e9cb0..c5d2eb11 100644 --- a/pkg/framework/objects/partial_license_map/model.go +++ b/pkg/framework/objects/partial_license_map/model.go @@ -2,18 +2,12 @@ package partial_license_map import ( "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/license_map" "github.com/hashicorp/terraform-plugin-framework/types" ) -// TODO: Move the model to the non partial when moved to the Framework -type LicenseMapResourceModel struct { - ID types.Int64 `tfsdk:"id"` - LicenseType types.String `tfsdk:"license_type"` - SSOLicenseMappingGroups types.Set `tfsdk:"sso_license_mapping_groups"` -} - func matchPartial( - licenseMapModel LicenseMapResourceModel, + licenseMapModel license_map.LicenseMapResourceModel, licenseTypeResponse dbt_cloud.LicenseMap, ) bool { return licenseMapModel.LicenseType == types.StringValue(licenseTypeResponse.LicenseType) diff --git a/pkg/framework/objects/partial_license_map/resource.go b/pkg/framework/objects/partial_license_map/resource.go index 3773099a..823c2851 100644 --- a/pkg/framework/objects/partial_license_map/resource.go +++ b/pkg/framework/objects/partial_license_map/resource.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/license_map" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/helper" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/types" @@ -37,7 +38,7 @@ func (r *partialLicenseMapResource) Read( req resource.ReadRequest, resp *resource.ReadResponse, ) { - var state LicenseMapResourceModel + var state license_map.LicenseMapResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &state)...) @@ -124,7 +125,7 @@ func (r *partialLicenseMapResource) Create( req resource.CreateRequest, resp *resource.CreateResponse, ) { - var plan LicenseMapResourceModel + var plan license_map.LicenseMapResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) if resp.Diagnostics.HasError() { @@ -220,7 +221,7 @@ func (r *partialLicenseMapResource) Delete( req resource.DeleteRequest, resp *resource.DeleteResponse, ) { - var state LicenseMapResourceModel + var state license_map.LicenseMapResourceModel resp.Diagnostics.Append(req.State.Get(ctx, &state)...) if resp.Diagnostics.HasError() { @@ -276,7 +277,7 @@ func (r *partialLicenseMapResource) Update( req resource.UpdateRequest, resp *resource.UpdateResponse, ) { - var plan, state LicenseMapResourceModel + var plan, state license_map.LicenseMapResourceModel resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...) resp.Diagnostics.Append(req.State.Get(ctx, &state)...) diff --git a/pkg/provider/framework_provider.go b/pkg/provider/framework_provider.go index 57fbcce1..958ea075 100644 --- a/pkg/provider/framework_provider.go +++ b/pkg/provider/framework_provider.go @@ -3,6 +3,7 @@ package provider import ( "context" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/azure_dev_ops_project" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/license_map" "os" "strconv" @@ -184,7 +185,7 @@ func (p *dbtCloudProvider) Configure( func (p *dbtCloudProvider) DataSources(_ context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ azure_dev_ops_project.AzureDevOpsProjectDataSource, - azure_dev_ops_repository.AzureDevOpsRepositoryDataSource, + azure_dev_ops_repository.AzureDevOpsRepositoryDataSource, user.UserDataSource, user.UsersDataSource, notification.NotificationDataSource, @@ -196,6 +197,7 @@ func (p *dbtCloudProvider) DataSources(_ context.Context) []func() datasource.Da project.ProjectsDataSource, global_connection.GlobalConnectionDataSource, global_connection.GlobalConnectionsDataSource, + azure_dev_ops_project.AzureDevOpsProjectDataSource, } } @@ -212,5 +214,6 @@ func (p *dbtCloudProvider) Resources(_ context.Context) []func() resource.Resour oauth_configuration.OAuthConfigurationResource, account_features.AccountFeaturesResource, ip_restrictions_rule.IPRestrictionsRuleResource, + license_map.LicenseMapResource, } } diff --git a/pkg/provider/sdk_provider.go b/pkg/provider/sdk_provider.go index 15add5b8..3d2fbfed 100644 --- a/pkg/provider/sdk_provider.go +++ b/pkg/provider/sdk_provider.go @@ -69,7 +69,6 @@ func SDKProvider(version string) func() *schema.Provider { "dbtcloud_repository": resources.ResourceRepository(), "dbtcloud_webhook": resources.ResourceWebhook(), "dbtcloud_user_groups": resources.ResourceUserGroups(), - "dbtcloud_license_map": resources.ResourceLicenseMap(), "dbtcloud_extended_attributes": resources.ResourceExtendedAttributes(), "dbtcloud_environment_variable_job_override": resources.ResourceEnvironmentVariableJobOverride(), "dbtcloud_fabric_connection": resources.ResourceFabricConnection(), diff --git a/pkg/sdkv2/resources/license_map.go b/pkg/sdkv2/resources/license_map.go deleted file mode 100644 index b017ac03..00000000 --- a/pkg/sdkv2/resources/license_map.go +++ /dev/null @@ -1,157 +0,0 @@ -package resources - -import ( - "context" - "strconv" - "strings" - - "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud" - "github.com/hashicorp/terraform-plugin-sdk/v2/diag" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation" -) - -var ( - licenseTypes = []string{ - "developer", - "read_only", - "it", - } -) - -func ResourceLicenseMap() *schema.Resource { - return &schema.Resource{ - CreateContext: licenseMapCreate, - ReadContext: licenseMapRead, - UpdateContext: licenseMapUpdate, - DeleteContext: licenseMapDelete, - - Schema: map[string]*schema.Schema{ - "license_type": { - Type: schema.TypeString, - Required: true, - Description: "License type", - ValidateFunc: validation.StringInSlice(licenseTypes, false), - }, - "sso_license_mapping_groups": { - Type: schema.TypeSet, - Optional: true, - Description: "SSO license mapping group names for this group", - Elem: &schema.Schema{ - Type: schema.TypeString, - }, - }, - }, - - Importer: &schema.ResourceImporter{ - StateContext: schema.ImportStatePassthroughContext, - }, - } -} - -func licenseMapCreate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - c := m.(*dbt_cloud.Client) - - var diags diag.Diagnostics - - licenseType := d.Get("license_type").(string) - ssoLicenseMappingGroupsRaw := d.Get("sso_license_mapping_groups").(*schema.Set).List() - ssoLicenseMappingGroups := []string{} - for _, g := range ssoLicenseMappingGroupsRaw { - ssoLicenseMappingGroups = append(ssoLicenseMappingGroups, g.(string)) - } - - licenseMap, err := c.CreateLicenseMap(licenseType, ssoLicenseMappingGroups) - if err != nil { - return diag.FromErr(err) - } - - d.SetId(strconv.Itoa(*licenseMap.ID)) - - licenseMapRead(ctx, d, m) - - return diags -} - -func licenseMapRead(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - c := m.(*dbt_cloud.Client) - - var diags diag.Diagnostics - - licenseMapID, err := strconv.Atoi(d.Id()) - if err != nil { - return diag.FromErr(err) - } - - licenseMap, err := c.GetLicenseMap(licenseMapID) - if err != nil { - if strings.HasPrefix(err.Error(), "resource-not-found") { - d.SetId("") - return diags - } - return diag.FromErr(err) - } - - if err := d.Set("license_type", licenseMap.LicenseType); err != nil { - return diag.FromErr(err) - } - if err := d.Set("sso_license_mapping_groups", licenseMap.SSOLicenseMappingGroups); err != nil { - return diag.FromErr(err) - } - - return diags -} - -func licenseMapUpdate(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - c := m.(*dbt_cloud.Client) - - var diags diag.Diagnostics - - licenseMapID, err := strconv.Atoi(d.Id()) - if err != nil { - return diag.FromErr(err) - } - - if d.HasChange("license_type") || d.HasChange("sso_license_mapping_groups") { - licenseMap, err := c.GetLicenseMap(licenseMapID) - if err != nil { - return diag.FromErr(err) - } - - if d.HasChange("license_type") { - licenseType := d.Get("license_type").(string) - licenseMap.LicenseType = licenseType - } - if d.HasChange("sso_license_mapping_groups") { - ssoLicenseMappingGroups := make([]string, len(d.Get("sso_license_mapping_groups").(*schema.Set).List())) - for i, g := range d.Get("sso_license_mapping_groups").(*schema.Set).List() { - ssoLicenseMappingGroups[i] = g.(string) - } - licenseMap.SSOLicenseMappingGroups = ssoLicenseMappingGroups - } - _, err = c.UpdateLicenseMap(licenseMapID, *licenseMap) - if err != nil { - return diag.FromErr(err) - } - } - - return diags -} - -func licenseMapDelete(ctx context.Context, d *schema.ResourceData, m interface{}) diag.Diagnostics { - c := m.(*dbt_cloud.Client) - - var diags diag.Diagnostics - - licenseMapID, err := strconv.Atoi(d.Id()) - if err != nil { - return diag.FromErr(err) - } - - err = c.DestroyLicenseMap(licenseMapID) - if err != nil { - return diag.FromErr(err) - } - - return diags -} From b2489cac020ab5fd2175da06ca4e5cf98fc727e8 Mon Sep 17 00:00:00 2001 From: Craig Squire <677724+csquire@users.noreply.github.com> Date: Thu, 12 Dec 2024 17:29:24 -0600 Subject: [PATCH 2/3] chore: Update docs --- docs/resources/license_map.md | 6 +++--- pkg/framework/objects/license_map/schema.go | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/resources/license_map.md b/docs/resources/license_map.md index 473ffb93..135da2b6 100644 --- a/docs/resources/license_map.md +++ b/docs/resources/license_map.md @@ -2,13 +2,13 @@ page_title: "dbtcloud_license_map Resource - dbtcloud" subcategory: "" description: |- - + Maps SSO groups to a given license type --- # dbtcloud_license_map (Resource) - +Maps SSO groups to a given license type ## Example Usage @@ -45,7 +45,7 @@ resource "dbtcloud_license_map" "it_license_map" { ### Read-Only -- `id` (String) The ID of this resource. +- `id` (Number) The ID of the license map ## Import diff --git a/pkg/framework/objects/license_map/schema.go b/pkg/framework/objects/license_map/schema.go index b691596e..b474a573 100644 --- a/pkg/framework/objects/license_map/schema.go +++ b/pkg/framework/objects/license_map/schema.go @@ -2,6 +2,7 @@ package license_map import ( "context" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/helper" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" @@ -17,6 +18,9 @@ func (r *licenseMapResource) Schema( resp *resource.SchemaResponse, ) { resp.Schema = schema.Schema{ + Description: helper.DocString( + `Maps SSO groups to a given license type`, + ), Attributes: map[string]schema.Attribute{ "id": schema.Int64Attribute{ Computed: true, From 81711d2e47d9f26fb1064575da253e20fdc34bfe Mon Sep 17 00:00:00 2001 From: Craig Squire <677724+csquire@users.noreply.github.com> Date: Tue, 17 Dec 2024 11:18:24 -0600 Subject: [PATCH 3/3] Merge issue --- pkg/provider/framework_provider.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/provider/framework_provider.go b/pkg/provider/framework_provider.go index 958ea075..f39ec800 100644 --- a/pkg/provider/framework_provider.go +++ b/pkg/provider/framework_provider.go @@ -2,13 +2,12 @@ package provider import ( "context" - "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/azure_dev_ops_project" - "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/license_map" "os" "strconv" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/dbt_cloud" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/account_features" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/azure_dev_ops_project" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/azure_dev_ops_repository" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/environment" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/global_connection" @@ -16,6 +15,7 @@ import ( "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/group_partial_permissions" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/ip_restrictions_rule" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/job" + "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/license_map" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/lineage_integration" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/notification" "github.com/dbt-labs/terraform-provider-dbtcloud/pkg/framework/objects/oauth_configuration" @@ -185,7 +185,7 @@ func (p *dbtCloudProvider) Configure( func (p *dbtCloudProvider) DataSources(_ context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ azure_dev_ops_project.AzureDevOpsProjectDataSource, - azure_dev_ops_repository.AzureDevOpsRepositoryDataSource, + azure_dev_ops_repository.AzureDevOpsRepositoryDataSource, user.UserDataSource, user.UsersDataSource, notification.NotificationDataSource, @@ -197,7 +197,6 @@ func (p *dbtCloudProvider) DataSources(_ context.Context) []func() datasource.Da project.ProjectsDataSource, global_connection.GlobalConnectionDataSource, global_connection.GlobalConnectionsDataSource, - azure_dev_ops_project.AzureDevOpsProjectDataSource, } }