Skip to content

Commit

Permalink
Changing from resource types to data types
Browse files Browse the repository at this point in the history
  • Loading branch information
STollenaar committed May 6, 2021
1 parent fb5a75a commit b355fac
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ HOSTNAME=spices.dev
NAMESPACE=stollenaar
NAME=unitconverter
BINARY=terraform-provider-${NAME}
VERSION=0.2.2
VERSION=0.2.3
OS_ARCH=linux_amd64

default: install
Expand Down
10 changes: 5 additions & 5 deletions unitconverter/resource_byte.go → unitconverter/data_byte.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// ResourceByteConverter defined resource for the terraform plugin
func ResourceByteConverter() *schema.Resource {
// DataByteConverter defined resource for the terraform plugin
func DataByteConverter() *schema.Resource {
return &schema.Resource{
Description: "The resource `unitconverter_byte` converts from the given byte type to the wanted byte type",
Create: ConvertFunc(GetByteTypes()),
Read: ReadNil,
Delete: schema.RemoveFromState,
Create: nil,
Read: ConvertFunc(GetByteTypes()),
Delete: nil,
SchemaVersion: 1,
Schema: ObjectSchema(),
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// ResourceLengthConverter defined resource for the terraform plugin
func ResourceLengthConverter() *schema.Resource {
// DataLengthConverter defined resource for the terraform plugin
func DataLengthConverter() *schema.Resource {
return &schema.Resource{
Description: "The resource `unitconverter_length` converts from the given length type to the wanted length type",
Create: ConvertFunc(GetLengthTypes()),
Read: ReadNil,
Delete: schema.RemoveFromState,
Create: nil,
Read: ConvertFunc(GetLengthTypes()),
Delete: nil,
SchemaVersion: 1,
Schema: ObjectSchema(),
}
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions unitconverter/resource_math.go → unitconverter/data_math.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// ResourceMath do simple math between mutliple resources of the same kind
func ResourceMath() *schema.Resource {
// DataMath do simple math between mutliple resources of the same kind
func DataMath() *schema.Resource {
return &schema.Resource{
Description: "The resource `unitconverter_math` does simple mathematical operations between 2 units",
Create: PrepareMath(),
Read: ReadNil,
Delete: schema.RemoveFromState,
Create: nil,
Read: PrepareMath(),
Delete: nil,
SchemaVersion: 1,
Schema: mathFields(),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// ResourceMathDownStep do simple math between mutliple resources of the same kind
func ResourceMathDownStep() *schema.Resource {
// DataMathDownStep do simple math between mutliple resources of the same kind
func DataMathDownStep() *schema.Resource {
return &schema.Resource{
Description: "The resource `unitconverter_math_downstep` converts the units value to a smaller one until its a whole number",
Create: StepDown(),
Read: ReadNil,
Delete: schema.RemoveFromState,
Create: nil,
Read: StepDown(),
Delete: nil,
SchemaVersion: 1,
Schema: stepFields(),
}
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions unitconverter/resource_time.go → unitconverter/data_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

// ResourceTimeConverter defined resource for the terraform plugin
func ResourceTimeConverter() *schema.Resource {
// DataTimeConverter defined resource for the terraform plugin
func DataTimeConverter() *schema.Resource {
return &schema.Resource{
Description: "The resource `unitconverter_time` converts from the given time type to the wanted time type",
Create: ConvertFunc(GetTimeTypes()),
Read: ReadNil,
Delete: schema.RemoveFromState,
Create: nil,
Read: ConvertFunc(GetTimeTypes()),
Delete: nil,
SchemaVersion: 1,
Schema: ObjectSchema(),
}
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions unitconverter/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ var testAccProvider *schema.Provider
// Provider -
func Provider() *schema.Provider {
return &schema.Provider{
ResourcesMap: map[string]*schema.Resource{
"unitconverter_time": ResourceTimeConverter(),
"unitconverter_length": ResourceLengthConverter(),
"unitconverter_byte": ResourceByteConverter(),
"unitconverter_math": ResourceMath(),
"unitconverter_step_down": ResourceMathDownStep(),
ResourcesMap: map[string]*schema.Resource{},
DataSourcesMap: map[string]*schema.Resource{
"unitconverter_time": DataTimeConverter(),
"unitconverter_length": DataLengthConverter(),
"unitconverter_byte": DataByteConverter(),
"unitconverter_math": DataMath(),
"unitconverter_step_down": DataMathDownStep(),
},
DataSourcesMap: map[string]*schema.Resource{},
}
}

0 comments on commit b355fac

Please sign in to comment.