Skip to content

Commit

Permalink
chore: add deprecation notice to number_of_zones
Browse files Browse the repository at this point in the history
  • Loading branch information
ianaya89 committed Nov 27, 2024
1 parent dc497c6 commit d2116fc
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ PROVIDER_BIN:=$(shell basename `git rev-parse --show-toplevel`)
PROVIDER_NAME:=$(shell echo $(PROVIDER_BIN) | sed 's/terraform-provider-//g')
PROVIDER_DIRECTORY:=~/.terraform.d/plugins/local/altinity/${PROVIDER_NAME}
DEFAULT_GRAPHQL_SCHEMA_FILE:=internal/sdk/client/graphql.schema
DEFAULT_GRAPHQL_SCHEMA_URL:=https://anywhere.dev.altinity.cloud/api/v1/graphql.schema
DEFAULT_GRAPHQL_SCHEMA_URL:=https://anywhere.altinity.cloud/api/v1/graphql.schema

GRAPHQL_SCHEMA_URL:=$(or $(GRAPHQL_SCHEMA_URL),$(DEFAULT_GRAPHQL_SCHEMA_URL))
GRAPHQL_SCHEMA_FILE:=$(or $(GRAPHQL_SCHEMA_FILE),$(DEFAULT_GRAPHQL_SCHEMA_FILE))
Expand Down
1 change: 1 addition & 0 deletions internal/provider/common/attributes.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ func GetNumberOfZonesAttribute(required, optional, computed bool) rschema.Int64A
Optional: optional,
Computed: computed,
MarkdownDescription: NUMBER_OF_ZONES_DESCRIPTION,
DeprecationMessage: "The 'number_of_zones' attribute is deprecated and will be removed soon. Use 'zones' instead.",
Validators: []validator.Int64{
int64validator.AtLeast(2),
},
Expand Down
5 changes: 1 addition & 4 deletions internal/provider/modifiers/zones_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ func (d *zonesAttributePlanModifier) MarkdownDescription(ctx context.Context) st
return d.Description(ctx)
}

// TODO: remove this modifier after deprecating number_of_zones
func (d *zonesAttributePlanModifier) PlanModifyInt64(ctx context.Context, req planmodifier.Int64Request, resp *planmodifier.Int64Response) {
var zones types.List
diags := req.Plan.GetAttribute(ctx, path.Root("zones"), &zones)
Expand All @@ -43,10 +44,6 @@ func (d *zonesAttributePlanModifier) PlanModifyInt64(ctx context.Context, req pl
return
}

// if !zones.IsNull() && numberOfZones.ValueInt64() > 0 {
// resp.Diagnostics.AddAttributeWarning(path.Root("zones"), "zones and number_of_zones are mutually exclusive", "if you set both, only zones will be used")
// }

if !zones.IsNull() && len(zones.Elements()) > 0 {
resp.PlanValue = types.Int64Value(int64(len(zones.Elements())))
return
Expand Down

0 comments on commit d2116fc

Please sign in to comment.