diff --git a/docs/data-sources/schema.md b/docs/data-sources/schema.md index 5d5a5a32..7bd90dfd 100644 --- a/docs/data-sources/schema.md +++ b/docs/data-sources/schema.md @@ -44,7 +44,6 @@ resource "atlas_schema" "hello" { ### Optional -- `dev_db_url` (String, Sensitive, Deprecated) Use `dev_url` instead. - `variables` (Map of String) The map of variables used in the HCL. ### Read-Only diff --git a/docs/resources/schema.md b/docs/resources/schema.md index 0fc1e804..165c1c55 100644 --- a/docs/resources/schema.md +++ b/docs/resources/schema.md @@ -34,7 +34,6 @@ resource "atlas_schema" "market" { ### Optional -- `dev_db_url` (String, Sensitive, Deprecated) Use `dev_url` instead. - `dev_url` (String, Sensitive) The url of the dev-db see https://atlasgo.io/cli/url - `diff` (Block, Optional) (see [below for nested schema](#nestedblock--diff)) - `exclude` (List of String) Filter out resources matching the given glob pattern. See https://atlasgo.io/declarative/inspect#exclude-schemas diff --git a/internal/provider/atlas_schema_data_source.go b/internal/provider/atlas_schema_data_source.go index 8a8aa00f..f8ac725e 100644 --- a/internal/provider/atlas_schema_data_source.go +++ b/internal/provider/atlas_schema_data_source.go @@ -27,8 +27,6 @@ type ( HCL types.String `tfsdk:"hcl"` ID types.String `tfsdk:"id"` Variables types.Map `tfsdk:"variables"` - - DeprecatedDevURL types.String `tfsdk:"dev_db_url"` } ) @@ -79,14 +77,6 @@ func (d *AtlasSchemaDataSource) Schema(_ context.Context, _ datasource.SchemaReq Optional: true, ElementType: types.StringType, }, - - "dev_db_url": schema.StringAttribute{ - Description: "Use `dev_url` instead.", - Optional: true, - Sensitive: true, - DeprecationMessage: "This attribute is deprecated and will be removed in the next major version. " + - "Please use the `dev_url` attribute instead.", - }, }, } } @@ -146,7 +136,7 @@ func (d *AtlasSchemaDataSource) Read(ctx context.Context, req datasource.ReadReq } } normalHCL, err := d.client.SchemaInspect(ctx, &atlas.SchemaInspectParams{ - DevURL: d.getDevURL(data.DevURL, data.DeprecatedDevURL), + DevURL: d.getDevURL(data.DevURL), Format: "hcl", URL: src, Vars: vars, diff --git a/internal/provider/atlas_schema_data_source_test.go b/internal/provider/atlas_schema_data_source_test.go index 5ab95102..ec07789b 100644 --- a/internal/provider/atlas_schema_data_source_test.go +++ b/internal/provider/atlas_schema_data_source_test.go @@ -54,7 +54,7 @@ func TestAccSchemaDataSource(t *testing.T) { // Read testing { Config: fmt.Sprintf(`data "atlas_schema" "market" { - dev_db_url = "mysql://root:pass@localhost:3307/test" + dev_url = "mysql://root:pass@localhost:3307/test" variables = { tenant = "test", } @@ -76,7 +76,7 @@ func TestAccSchemaDataSource(t *testing.T) { // Read testing { Config: `data "atlas_schema" "market" { - dev_db_url = "mysql://root:pass@localhost:3307/test" + dev_url = "mysql://root:pass@localhost:3307/test" src = "" }`, Check: resource.ComposeAggregateTestCheckFunc( @@ -117,6 +117,7 @@ func TestAccSchemaDataSource(t *testing.T) { } data "atlas_schema" "hello" { src = "file://./sql-files/schema.sql" + dev_url = "mysql://root:pass@localhost:3307/test" }`, Check: resource.ComposeAggregateTestCheckFunc( resource.TestCheckResourceAttr("data.atlas_schema.hello", "hcl", normalHCL), diff --git a/internal/provider/atlas_schema_resource.go b/internal/provider/atlas_schema_resource.go index e9463d5f..1ba096f9 100644 --- a/internal/provider/atlas_schema_resource.go +++ b/internal/provider/atlas_schema_resource.go @@ -35,8 +35,6 @@ type ( TxMode types.String `tfsdk:"tx_mode"` // Policies Diff *Diff `tfsdk:"diff"` - - DeprecatedDevURL types.String `tfsdk:"dev_db_url"` } // Diff defines the diff policies to apply when planning schema changes. Diff struct { @@ -174,13 +172,6 @@ func (r *AtlasSchemaResource) Schema(ctx context.Context, _ resource.SchemaReque stringplanmodifier.UseStateForUnknown(), }, }, - "dev_db_url": schema.StringAttribute{ - Description: "Use `dev_url` instead.", - Optional: true, - Sensitive: true, - DeprecationMessage: "This attribute is deprecated and will be removed in the next major version. " + - "Please use the `dev_url` attribute instead.", - }, }, } } @@ -306,7 +297,7 @@ func (r *AtlasSchemaResource) ModifyPlan(ctx context.Context, req resource.Modif return } } - resp.Diagnostics.Append(PrintPlanSQL(ctx, r.client, r.getDevURL(plan.DevURL, plan.DeprecatedDevURL), plan)...) + resp.Diagnostics.Append(PrintPlanSQL(ctx, r.client, r.getDevURL(plan.DevURL), plan)...) } func PrintPlanSQL(ctx context.Context, c *atlas.Client, devURL string, data *AtlasSchemaResourceModel) (diags diag.Diagnostics) { @@ -385,7 +376,7 @@ func (r *AtlasSchemaResource) applySchema(ctx context.Context, data *AtlasSchema } d := &schemaData{ URL: u, - DevURL: r.getDevURL(data.DevURL, data.DeprecatedDevURL), + DevURL: r.getDevURL(data.DevURL), Source: "schema.hcl", Diff: data.Diff, } diff --git a/internal/provider/atlas_schema_resource_test.go b/internal/provider/atlas_schema_resource_test.go index 26c932e5..fa0695c0 100644 --- a/internal/provider/atlas_schema_resource_test.go +++ b/internal/provider/atlas_schema_resource_test.go @@ -33,7 +33,7 @@ resource "foo_mirror" "url" { value = "%s" } data "atlas_schema" "market" { - dev_db_url = "%s" + dev_url = "%s" src = <<-EOT schema "test" { charset = "utf8mb4" @@ -55,13 +55,13 @@ data "atlas_schema" "market" { resource "atlas_schema" "testdb" { hcl = data.atlas_schema.market.hcl url = foo_mirror.url.result - dev_db_url = "%s" + dev_url = "%s" } `, mysqlURL, mysqlDevURL, mysqlDevURL) var testAccActionConfigUpdate = fmt.Sprintf(` data "atlas_schema" "market" { - dev_db_url = "%s" + dev_url = "%s" src = <<-EOT schema "test" { charset = "utf8mb4" @@ -355,7 +355,7 @@ schema "test" { } testAccSanityT = ` data "atlas_schema" "sanity" { - dev_db_url = "%s" + dev_url = "%s" src = <<-EOT %s EOT