Skip to content

Commit

Permalink
Rewrite remaining files
Browse files Browse the repository at this point in the history
  • Loading branch information
guineveresaenger committed Jul 17, 2024
1 parent 231d5ca commit b26c20d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pf/internal/schemashim/convert_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"fmt"

pfattr "github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/hashicorp/terraform-plugin-go/tftypes"

shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
Expand All @@ -34,7 +34,7 @@ func convertType(typ pfattr.Type) (shim.ValueType, error) {
switch {
case is(tftypes.Bool):
return shim.TypeBool, nil
case typ.Equal(types.Int64Type):
case typ.Equal(basetypes.Int64Type{}):
// We special case int, since it is a stable type but not present on the wire.
return shim.TypeInt, nil
case is(tftypes.Number):
Expand Down
5 changes: 2 additions & 3 deletions pf/internal/schemashim/custom_object_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (

"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/diag"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/hashicorp/terraform-plugin-go/tftypes"
"github.com/stretchr/testify/assert"
Expand All @@ -35,12 +34,12 @@ func TestCustomObject(t *testing.T) {

obj := newObjectPseudoResource(NewObjectTypeOf[SomeType](ctx), nil, nil)

s := obj.Schema().Get("s")
s := obj.Schema().Get("sample_string")
assert.Equal(t, shim.TypeString, s.Type())
}

type SomeType struct {
S types.String `tfsdk:"s"`
SampleString basetypes.StringValue `tfsdk:"sample_string"`
}

// --- custom object machinery ---
Expand Down
6 changes: 3 additions & 3 deletions pf/internal/schemashim/object_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (

"github.com/hashicorp/terraform-plugin-framework/attr"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand All @@ -33,7 +33,7 @@ import (
func TestObjectAttribute(t *testing.T) {
objectAttr := schema.ObjectAttribute{
AttributeTypes: map[string]attr.Type{
"s": types.StringType,
"s": basetypes.StringType{},
},
}
shimmed := &attrSchema{"key", pfutils.FromAttrLike(objectAttr)}
Expand All @@ -44,7 +44,7 @@ func TestObjectAttribute(t *testing.T) {

func TestTypeSchemaDescriptionIsEmpty(t *testing.T) {
shimmedType := &typeSchema{
t: types.StringType,
t: basetypes.StringType{},
nested: nil,
}
assert.Equal(t, shimmedType.Description(), "")
Expand Down
6 changes: 4 additions & 2 deletions pf/internal/schemashim/type_schema_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package schemashim

import (
"testing"

"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/types/basetypes"
shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
"github.com/stretchr/testify/assert"
"testing"

shim "github.com/pulumi/pulumi-terraform-bridge/v3/pkg/tfshim"
)

func TestMapAttribute(t *testing.T) {
Expand Down

0 comments on commit b26c20d

Please sign in to comment.