/
autoscaling.go
47 lines (43 loc) · 1.63 KB
/
autoscaling.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
42
43
44
45
46
47
package hcp
import (
dsschema "github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
)
type AutoScaling struct {
Enabled types.Bool `tfsdk:"enabled"`
MinReplicas types.Int64 `tfsdk:"min_replicas"`
MaxReplicas types.Int64 `tfsdk:"max_replicas"`
}
func AutoscalingResource() map[string]schema.Attribute {
return map[string]schema.Attribute{
"enabled": schema.BoolAttribute{
Description: "Enables autoscaling. If `true`, this variable requires you to set a maximum and minimum replicas range using the `max_replicas` and `min_replicas` variables.",
Required: true,
},
"min_replicas": schema.Int64Attribute{
Description: "The minimum number of replicas for autoscaling functionality.",
Optional: true,
},
"max_replicas": schema.Int64Attribute{
Description: "The maximum number of replicas for autoscaling functionality.",
Optional: true,
},
}
}
func AutoscalingDatasource() map[string]dsschema.Attribute {
return map[string]dsschema.Attribute{
"enabled": schema.BoolAttribute{
Description: "Enables autoscaling. If `true`, this variable requires you to set a maximum and minimum replicas range using the `max_replicas` and `min_replicas` variables.",
Computed: true,
},
"min_replicas": schema.Int64Attribute{
Description: "The minimum number of replicas for autoscaling functionality.",
Computed: true,
},
"max_replicas": schema.Int64Attribute{
Description: "The maximum number of replicas for autoscaling functionality.",
Computed: true,
},
}
}