-
Notifications
You must be signed in to change notification settings - Fork 43
/
edge_zone.go
41 lines (36 loc) · 1.22 KB
/
edge_zone.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package commonschema
import (
"github.com/hashicorp/go-azure-helpers/resourcemanager/edgezones"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
)
// EdgeZoneComputed returns the schema for an Edge Zone which is Computed
func EdgeZoneComputed() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Computed: true,
}
}
// EdgeZoneOptional returns the schema for an Edge Zone which is Optional
func EdgeZoneOptional() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
ValidateFunc: validation.StringIsNotEmpty,
StateFunc: edgezones.StateFunc,
DiffSuppressFunc: edgezones.DiffSuppressFunc,
}
}
// EdgeZoneOptionalForceNew returns the schema for an Edge Zone which is both Optional and ForceNew
func EdgeZoneOptionalForceNew() *schema.Schema {
return &schema.Schema{
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: validation.StringIsNotEmpty,
StateFunc: edgezones.StateFunc,
DiffSuppressFunc: edgezones.DiffSuppressFunc,
}
}