Skip to content

Commit

Permalink
fix: Go module name update
Browse files Browse the repository at this point in the history
  • Loading branch information
11052523011407 committed Aug 17, 2024
1 parent 1acfa56 commit 20ab96b
Show file tree
Hide file tree
Showing 21 changed files with 73 additions and 73 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ The main configuration file is `provider.tf`, which defines the settings for the
```hcl
terraform {
required_providers {
sfr = {
source = "registry.terraform.io/pseudomonarchia/shopify-function-registry"
shopify = {
source = "registry.terraform.io/pseudomonarchia/terraform-provider-shopify"
version = "0.0.1"
}
}
}
provider "sfr" {
provider "shopify" {
store_domain = "<store>.myshopify.com"
store_access_token = "<access_token>"
store_api_version = "2024-07"
Expand Down
6 changes: 3 additions & 3 deletions examples/data-sources/sfr_function/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
data "sfr_function" "example_discount" {
data "shopify_function" "example_discount" {
app_title = "MyAPP"
title = "Discount Automatic Extension"
}

data "sfr_function" "example_payment" {
data "shopify_function" "example_payment" {
app_title = "MyAPP"
title = "Payment Customization Extension"
}

data "sfr_function" "example_delivery" {
data "shopify_function" "example_delivery" {
app_title = "MyAPP"
title = "Delivery Customization Extension"
}
6 changes: 3 additions & 3 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
terraform {
required_providers {
sfr = {
source = "registry.terraform.io/pseudomonarchia/shopify-function-registry"
shopify = {
source = "registry.terraform.io/pseudomonarchia/terraform-provider-shopify"
version = "0.0.1"
}
}
}

provider "sfr" {
provider "shopify" {
store_domain = "<store>.myshopify.com"
store_access_token = "<access_token>"
store_api_version = "2024-07"
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/sfr_delivery/import.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
terraform import sfr_delivery.example <delivery_id>,<function_id>
terraform import shopify_delivery.example <delivery_id>,<function_id>
2 changes: 1 addition & 1 deletion examples/resources/sfr_delivery/resource.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "sfr_delivery" "example" {
resource "shopify_delivery" "example" {
function_id = "<UUID>"
title = "Delivery Customization"
enabled = true
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/sfr_discount/import.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
terraform import sfr_discount.example <discount_id>,<function_id>
terraform import shopify_discount.example <discount_id>,<function_id>
2 changes: 1 addition & 1 deletion examples/resources/sfr_discount/resource.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "sfr_discount" "example" {
resource "shopify_discount" "example" {
function_id = "<UUID>"
title = "Automatic Discount"
starts_at = "2024-01-09T00:00:00Z"
Expand Down
2 changes: 1 addition & 1 deletion examples/resources/sfr_payment/import.sh
Original file line number Diff line number Diff line change
@@ -1 +1 @@
terraform import sfr_payment.example <payment_id>,<function_id>
terraform import shopify_payment.example <payment_id>,<function_id>
2 changes: 1 addition & 1 deletion examples/resources/sfr_payment/resource.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resource "sfr_payment" "example" {
resource "shopify_payment" "example" {
function_id = "<UUID>"
title = "Payment Customization"
enabled = true
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module shopify-function-registry
module github.com/pseudomonarchia/terraform-provider-shopify

go 1.22.6

Expand Down
2 changes: 1 addition & 1 deletion internal/provider/delivery_custom_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"regexp"
"shopify-function-registry/internal/shopify"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
Expand All @@ -15,6 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/pseudomonarchia/terraform-provider-shopify/internal/shopify"
)

var _ resource.Resource = (*deliveryCustomResource)(nil)
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/delivery_custom_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ func TestAccDeliveryCustomResource(t *testing.T) {
{
Config: testAccDeliveryCustomResourceConfig("test_delivery", true),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_delivery.test", "title", "test_delivery"),
resource.TestCheckResourceAttr("sfr_delivery.test", "enabled", "true"),
resource.TestCheckResourceAttrSet("sfr_delivery.test", "id"),
resource.TestCheckResourceAttrSet("sfr_delivery.test", "function_id"),
resource.TestCheckResourceAttr("shopify_delivery.test", "title", "test_delivery"),
resource.TestCheckResourceAttr("shopify_delivery.test", "enabled", "true"),
resource.TestCheckResourceAttrSet("shopify_delivery.test", "id"),
resource.TestCheckResourceAttrSet("shopify_delivery.test", "function_id"),
),
},
// 更新測試
{
Config: testAccDeliveryCustomResourceConfig("updated_delivery", false),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_delivery.test", "title", "updated_delivery"),
resource.TestCheckResourceAttr("sfr_delivery.test", "enabled", "false"),
resource.TestCheckResourceAttr("shopify_delivery.test", "title", "updated_delivery"),
resource.TestCheckResourceAttr("shopify_delivery.test", "enabled", "false"),
),
},
// 導入測試
{
ResourceName: "sfr_delivery.test",
ResourceName: "shopify_delivery.test",
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: testAccDeliveryCustomResourceImportStateIdFunc,
Expand All @@ -44,7 +44,7 @@ func TestAccDeliveryCustomResource(t *testing.T) {
func testAccDeliveryCustomResourceConfig(title string, enabled bool) string {
return fmt.Sprintf(
`
resource "sfr_delivery" "test" {
resource "shopify_delivery" "test" {
function_id = "00000000-0000-0000-0000-000000000000"
title = %q
enabled = %t
Expand All @@ -56,9 +56,9 @@ func testAccDeliveryCustomResourceConfig(title string, enabled bool) string {
}

func testAccDeliveryCustomResourceImportStateIdFunc(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources["sfr_delivery.test"]
rs, ok := s.RootModule().Resources["shopify_delivery.test"]
if !ok {
return "", fmt.Errorf("Resource not found: sfr_delivery.test")
return "", fmt.Errorf("Resource not found: shopify_delivery.test")
}

return fmt.Sprintf("%s,%s", rs.Primary.ID, rs.Primary.Attributes["function_id"]), nil
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/discount_automatic_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"regexp"
"shopify-function-registry/internal/shopify"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
Expand All @@ -15,6 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/pseudomonarchia/terraform-provider-shopify/internal/shopify"
)

var _ resource.Resource = (*discountAutomaticResource)(nil)
Expand Down
36 changes: 18 additions & 18 deletions internal/provider/discount_automatic_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ func TestAccDiscountAutomaticResource(t *testing.T) {
{
Config: testAccDiscountAutomaticResourceConfig(startTime, endTime, true, false, true, false),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_discount.test", "title", "test_discount"),
resource.TestCheckResourceAttr("sfr_discount.test", "starts_at", startTime),
resource.TestCheckResourceAttr("sfr_discount.test", "ends_at", endTime),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.order_discounts", "true"),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.product_discounts", "false"),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.shipping_discounts", "true"),
resource.TestCheckResourceAttrSet("sfr_discount.test", "id"),
resource.TestCheckResourceAttrSet("sfr_discount.test", "function_id"),
resource.TestCheckResourceAttr("shopify_discount.test", "title", "test_discount"),
resource.TestCheckResourceAttr("shopify_discount.test", "starts_at", startTime),
resource.TestCheckResourceAttr("shopify_discount.test", "ends_at", endTime),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.order_discounts", "true"),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.product_discounts", "false"),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.shipping_discounts", "true"),
resource.TestCheckResourceAttrSet("shopify_discount.test", "id"),
resource.TestCheckResourceAttrSet("shopify_discount.test", "function_id"),
),
},
// 更新測試
{
Config: testAccDiscountAutomaticResourceConfig(updatedStartTime, "", false, true, false, true),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_discount.test", "title", "updated_discount"),
resource.TestCheckResourceAttr("sfr_discount.test", "starts_at", updatedStartTime),
resource.TestCheckResourceAttr("sfr_discount.test", "ends_at", ""),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.order_discounts", "false"),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.product_discounts", "true"),
resource.TestCheckResourceAttr("sfr_discount.test", "combines_with.shipping_discounts", "false"),
resource.TestCheckResourceAttr("shopify_discount.test", "title", "updated_discount"),
resource.TestCheckResourceAttr("shopify_discount.test", "starts_at", updatedStartTime),
resource.TestCheckResourceAttr("shopify_discount.test", "ends_at", ""),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.order_discounts", "false"),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.product_discounts", "true"),
resource.TestCheckResourceAttr("shopify_discount.test", "combines_with.shipping_discounts", "false"),
),
},
// 導入測試
{
ResourceName: "sfr_discount.test",
ResourceName: "shopify_discount.test",
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: testAccDiscountAutomaticResourceImportStateIdFunc,
Expand All @@ -67,7 +67,7 @@ func testAccDiscountAutomaticResourceConfig(startsAt, endsAt string, orderDiscou

return fmt.Sprintf(
`
resource "sfr_discount" "test" {
resource "shopify_discount" "test" {
function_id = "00000000-0000-0000-0000-000000000000"
title = %q
starts_at = %q
Expand All @@ -89,9 +89,9 @@ func testAccDiscountAutomaticResourceConfig(startsAt, endsAt string, orderDiscou
}

func testAccDiscountAutomaticResourceImportStateIdFunc(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources["sfr_discount.test"]
rs, ok := s.RootModule().Resources["shopify_discount.test"]
if !ok {
return "", fmt.Errorf("Resource not found: sfr_discount.test")
return "", fmt.Errorf("Resource not found: shopify_discount.test")
}

return fmt.Sprintf("%s,%s", rs.Primary.ID, rs.Primary.Attributes["function_id"]), nil
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/function_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package provider
import (
"context"
"fmt"
"shopify-function-registry/internal/shopify"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
"github.com/hashicorp/terraform-plugin-framework/datasource/schema"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/pseudomonarchia/terraform-provider-shopify/internal/shopify"
)

var _ datasource.DataSource = &FunctinDataSource{}
Expand Down
12 changes: 6 additions & 6 deletions internal/provider/function_datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ func TestAccFunctionDataSource(t *testing.T) {
{
Config: testAccFunctionDataSourceConfig(),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttrSet("data.sfr_function.test", "id"),
resource.TestCheckResourceAttr("data.sfr_function.test", "title", "test_function"),
resource.TestCheckResourceAttr("data.sfr_function.test", "app_title", "test_app"),
resource.TestCheckResourceAttrSet("data.sfr_function.test", "api_type"),
resource.TestCheckResourceAttrSet("data.shopify_function.test", "id"),
resource.TestCheckResourceAttr("data.shopify_function.test", "title", "test_function"),
resource.TestCheckResourceAttr("data.shopify_function.test", "app_title", "test_app"),
resource.TestCheckResourceAttrSet("data.shopify_function.test", "api_type"),
),
},
},
Expand All @@ -27,7 +27,7 @@ func TestAccFunctionDataSource(t *testing.T) {

func testAccFunctionDataSourceConfig() string {
return `
data "sfr_function" "test" {
data "shopify_function" "test" {
title = "test_function"
app_title = "test_app"
}
Expand All @@ -48,7 +48,7 @@ func TestAccFunctionDataSource_NotFound(t *testing.T) {

func testAccFunctionDataSourceConfig_NotFound() string {
return `
data "sfr_function" "test" {
data "shopify_function" "test" {
title = "non_existent_function"
app_title = "non_existent_app"
}
Expand Down
2 changes: 1 addition & 1 deletion internal/provider/payment_custom_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"fmt"
"regexp"
"shopify-function-registry/internal/shopify"
"strings"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
Expand All @@ -15,6 +14,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/pseudomonarchia/terraform-provider-shopify/internal/shopify"
)

var _ resource.Resource = (*paymentCustomResource)(nil)
Expand Down
20 changes: 10 additions & 10 deletions internal/provider/payment_custom_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ func TestAccPaymentCustomResource(t *testing.T) {
{
Config: testAccPaymentCustomResourceConfig("test_payment", true),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_payment.test", "title", "test_payment"),
resource.TestCheckResourceAttr("sfr_payment.test", "enabled", "true"),
resource.TestCheckResourceAttrSet("sfr_payment.test", "id"),
resource.TestCheckResourceAttrSet("sfr_payment.test", "function_id"),
resource.TestCheckResourceAttr("shopify_payment.test", "title", "test_payment"),
resource.TestCheckResourceAttr("shopify_payment.test", "enabled", "true"),
resource.TestCheckResourceAttrSet("shopify_payment.test", "id"),
resource.TestCheckResourceAttrSet("shopify_payment.test", "function_id"),
),
},
// 更新測試
{
Config: testAccPaymentCustomResourceConfig("updated_payment", false),
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("sfr_payment.test", "title", "updated_payment"),
resource.TestCheckResourceAttr("sfr_payment.test", "enabled", "false"),
resource.TestCheckResourceAttr("shopify_payment.test", "title", "updated_payment"),
resource.TestCheckResourceAttr("shopify_payment.test", "enabled", "false"),
),
},
// 導入測試
{
ResourceName: "sfr_payment.test",
ResourceName: "shopify_payment.test",
ImportState: true,
ImportStateVerify: true,
ImportStateIdFunc: testAccPaymentCustomResourceImportStateIdFunc,
Expand All @@ -44,7 +44,7 @@ func TestAccPaymentCustomResource(t *testing.T) {
func testAccPaymentCustomResourceConfig(title string, enabled bool) string {
return fmt.Sprintf(
`
resource "sfr_payment" "test" {
resource "shopify_payment" "test" {
function_id = "00000000-0000-0000-0000-000000000000"
title = %q
enabled = %t
Expand All @@ -56,9 +56,9 @@ func testAccPaymentCustomResourceConfig(title string, enabled bool) string {
}

func testAccPaymentCustomResourceImportStateIdFunc(s *terraform.State) (string, error) {
rs, ok := s.RootModule().Resources["sfr_payment.test"]
rs, ok := s.RootModule().Resources["shopify_payment.test"]
if !ok {
return "", fmt.Errorf("Resource not found: sfr_payment.test")
return "", fmt.Errorf("Resource not found: shopify_payment.test")
}

return fmt.Sprintf("%s,%s", rs.Primary.ID, rs.Primary.Attributes["function_id"]), nil
Expand Down
4 changes: 2 additions & 2 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package provider
import (
"context"
"regexp"
"shopify-function-registry/internal/shopify"

"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
"github.com/hashicorp/terraform-plugin-framework/datasource"
Expand All @@ -12,6 +11,7 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
"github.com/hashicorp/terraform-plugin-framework/types"
"github.com/pseudomonarchia/terraform-provider-shopify/internal/shopify"
)

var _ provider.Provider = (*funcProvider)(nil)
Expand Down Expand Up @@ -39,7 +39,7 @@ func (p *funcProvider) Metadata(
_ provider.MetadataRequest,
resp *provider.MetadataResponse,
) {
resp.TypeName = "sfr"
resp.TypeName = "shopify"
resp.Version = p.version
}

Expand Down
Loading

0 comments on commit 20ab96b

Please sign in to comment.