Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ require (
github.com/hashicorp/logutils v1.0.0 // indirect
github.com/hashicorp/terraform-exec v0.23.0 // indirect
github.com/hashicorp/terraform-json v0.25.0 // indirect
github.com/hashicorp/terraform-plugin-framework-validators v0.18.0 // indirect
github.com/hashicorp/terraform-plugin-sdk/v2 v2.37.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
Expand All @@ -110,13 +111,13 @@ require (
require (
github.com/cenkalti/backoff/v5 v5.0.2 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250617093736-a5a3abe25511
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250624122835-08527daf62c5
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

require (
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250617093736-a5a3abe25511
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250624122835-08527daf62c5
github.com/go-jose/go-jose/v4 v4.0.5 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/hashicorp/terraform-plugin-testing v1.13.1
Expand Down
10 changes: 6 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ github.com/formancehq/formance-sdk-go/v3 v3.5.0 h1:4qUhPOaF0igfH+cR95bnsteNXoidZ
github.com/formancehq/formance-sdk-go/v3 v3.5.0/go.mod h1:6V6/yj6FZDYS3lA7R8d93y/Z4mQbLdGoNOYEMrUKUWM=
github.com/formancehq/go-libs/v3 v3.0.0-20250522193102-7361760ee4ef h1:yrhbW231+FUOUrrKGsDhUyqhWFIjFv4TLtoP6L6HJgc=
github.com/formancehq/go-libs/v3 v3.0.0-20250522193102-7361760ee4ef/go.mod h1:faThzFZoF/9uEZQgifklAespL+quZ1CnTTF63+mG950=
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250617093736-a5a3abe25511 h1:yWljUOJPjiYza7f6tEAoxBb5pohcG5auwbaSqwIWR/A=
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250617093736-a5a3abe25511/go.mod h1:Mho2pUyEDMBa40z1O2hTWND3J7Db8f5smkBdv/URkrU=
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250617093736-a5a3abe25511 h1:TafrTTiry/UcvRr5OG4yKgA2hMtoJjOFoymPLIX2CwM=
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250617093736-a5a3abe25511/go.mod h1:6XkfNbGruADRkgUtfu9+U069EZt+4Ev5sVWUjq1FnOI=
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250624122835-08527daf62c5 h1:wx4RAoHRP7L3pAmMlgSAO1eQEWwYmaND4bd1dmTtd60=
github.com/formancehq/terraform-provider-cloud v0.0.5-0.20250624122835-08527daf62c5/go.mod h1:ND38nmai7sABUwH97OYaE+IvsPArTdU511Z7y4sSGgs=
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250624122835-08527daf62c5 h1:5nBh+ygIPfw0FFwjyfPORdOpgI+myAd/RVsRqV4bTEg=
github.com/formancehq/terraform-provider-cloud/sdk v0.0.0-20250624122835-08527daf62c5/go.mod h1:6XkfNbGruADRkgUtfu9+U069EZt+4Ev5sVWUjq1FnOI=
github.com/go-chi/chi/v5 v5.2.1 h1:KOIHODQj58PmL80G2Eak4WdvUzjSJSm0vG72crDCqb8=
github.com/go-chi/chi/v5 v5.2.1/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops=
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI=
Expand Down Expand Up @@ -115,6 +115,8 @@ github.com/hashicorp/terraform-json v0.25.0 h1:rmNqc/CIfcWawGiwXmRuiXJKEiJu1ntGo
github.com/hashicorp/terraform-json v0.25.0/go.mod h1:sMKS8fiRDX4rVlR6EJUMudg1WcanxCMoWwTLkgZP/vc=
github.com/hashicorp/terraform-plugin-framework v1.15.0 h1:LQ2rsOfmDLxcn5EeIwdXFtr03FVsNktbbBci8cOKdb4=
github.com/hashicorp/terraform-plugin-framework v1.15.0/go.mod h1:hxrNI/GY32KPISpWqlCoTLM9JZsGH3CyYlir09bD/fI=
github.com/hashicorp/terraform-plugin-framework-validators v0.18.0 h1:OQnlOt98ua//rCw+QhBbSqfW3QbwtVrcdWeQN5gI3Hw=
github.com/hashicorp/terraform-plugin-framework-validators v0.18.0/go.mod h1:lZvZvagw5hsJwuY7mAY6KUz45/U6fiDR0CzQAwWD0CA=
github.com/hashicorp/terraform-plugin-go v0.27.0 h1:ujykws/fWIdsi6oTUT5Or4ukvEan4aN9lY+LOxVP8EE=
github.com/hashicorp/terraform-plugin-go v0.27.0/go.mod h1:FDa2Bb3uumkTGSkTFpWSOwWJDwA7bf3vdP3ltLDTH6o=
github.com/hashicorp/terraform-plugin-log v0.9.0 h1:i7hOA+vdAItN1/7UrfBqBwvYPQ9TFvymaRGZED3FCV0=
Expand Down
9 changes: 0 additions & 9 deletions internal/resources/main_test.go

This file was deleted.

5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
// Format Terraform code for use in documentation.
// If you do not have Terraform installed, you can remove the formatting command, but it is suggested
// to ensure the documentation is formatted properly.

//go:generate rm -rf docs
//go:generate mkdir docs
//go:generate terraform fmt -recursive ./examples/

// Generate documentation.
//
//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@latest generate --provider-dir . -provider-name formancestack

package main

import "github.com/formancehq/terraform-provider-stack/cmd"
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ func TestLedger(t *testing.T) {
Steps: []resource.TestStep{
newTestStepStack(),
{
Config: newStack(OrganizationId, RegionName) +
Config: newStack(RegionName) +
`
provider "formancestack" {
stack_id = formancecloud_stack.default.id
organization_id = formancecloud_stack.default.organization_id
organization_id = data.formancecloud_current_organization.default.id
uri = formancecloud_stack.default.uri
}

Expand All @@ -55,11 +55,11 @@ func TestLedger(t *testing.T) {
},
},
{
Config: newStack(OrganizationId, RegionName) +
Config: newStack(RegionName) +
`
provider "formancestack" {
stack_id = formancecloud_stack.default.id
organization_id = formancecloud_stack.default.organization_id
organization_id = data.formancecloud_current_organization.default.id
uri = formancecloud_stack.default.uri
}

Expand Down
24 changes: 9 additions & 15 deletions tests/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ import (
)

var (
CloudProvider func() provider.Provider
StackProvider func() provider.Provider
RegionName = ""
OrganizationId = ""
CloudProvider func() provider.Provider
StackProvider func() provider.Provider
RegionName = ""
)

func newTestStepStack() resource.TestStep {
return resource.TestStep{
Config: newStack(OrganizationId, RegionName),
Config: newStack(RegionName),
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue("formancecloud_stack.default", tfjsonpath.New("name"), knownvalue.StringExact("test")),
statecheck.ExpectKnownValue("formancecloud_stack.default", tfjsonpath.New("id"), knownvalue.StringRegexp(regexp.MustCompile(`.+`))),
Expand All @@ -50,9 +49,8 @@ func TestMain(m *testing.M) {

// TODO: This can be replaced with TF variables in the future
RegionName = os.Getenv("FORMANCE_CLOUD_REGION_NAME")
OrganizationId = os.Getenv("FORMANCE_CLOUD_ORGANIZATION_ID")
if RegionName == "" || OrganizationId == "" || endpoint == "" || clientID == "" || clientSecret == "" {
missingVars := []string{RegionName, OrganizationId, endpoint, clientID, clientSecret}
if RegionName == "" || endpoint == "" || clientID == "" || clientSecret == "" {
missingVars := []string{RegionName, endpoint, clientID, clientSecret}
missingVars = collectionutils.Filter(missingVars, func(s string) bool {
return s == ""
})
Expand Down Expand Up @@ -89,7 +87,7 @@ func TestMain(m *testing.M) {
clientID,
clientSecret,
transport,
cloudpkg.NewSDK,
cloudpkg.NewCloudSDK(),
cloudpkg.NewTokenProvider,
)

Expand All @@ -98,20 +96,16 @@ func TestMain(m *testing.M) {
os.Exit(code)
}

func newStack(organizationId, regionName string) string {
func newStack(regionName string) string {
return `
data "formancecloud_organizations" "default" {
id = "` + organizationId + `"
}
data "formancecloud_current_organization" "default" {}

data "formancecloud_regions" "default" {
name = "` + regionName + `"
organization_id = data.formancecloud_organizations.default.id
}

resource "formancecloud_stack" "default" {
name = "test"
organization_id = data.formancecloud_organizations.default.id
region_id = data.formancecloud_regions.default.id

force_destroy = true
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/noop_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ func TestNoopResources(t *testing.T) {
Steps: []resource.TestStep{
newTestStepStack(),
{
Config: newStack(OrganizationId, RegionName) +
Config: newStack(RegionName) +
`
provider "formancestack" {
stack_id = formancecloud_stack.default.id
organization_id = formancecloud_stack.default.organization_id
organization_id = data.formancecloud_current_organization.default.id
uri = formancecloud_stack.default.uri
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/stack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func TestStack(t *testing.T) {
},
Steps: []resource.TestStep{
{
Config: newStack(OrganizationId, RegionName),
Config: newStack(RegionName),
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue("formancecloud_stack.default", tfjsonpath.New("name"), knownvalue.StringExact("test")),
statecheck.ExpectKnownValue("formancecloud_stack.default", tfjsonpath.New("id"), knownvalue.StringRegexp(regexp.MustCompile(`.+`))),
Expand Down
10 changes: 4 additions & 6 deletions tests/e2e/webhooks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,16 @@ func TestWebhooks(t *testing.T) {
Steps: []resource.TestStep{
newTestStepStack(),
{
Config: newStack(OrganizationId, RegionName) +
Config: newStack(RegionName) +
`
resource "formancecloud_stack_module" "webhooks" {
name = "webhooks"
stack_id = formancecloud_stack.default.id
organization_id = data.formancecloud_organizations.default.id
}

provider "formancestack" {
stack_id = formancecloud_stack.default.id
organization_id = formancecloud_stack.default.organization_id
organization_id = data.formancecloud_current_organization.default.id
uri = formancecloud_stack.default.uri
}

Expand Down Expand Up @@ -66,17 +65,16 @@ func TestWebhooks(t *testing.T) {
},
},
{
Config: newStack(OrganizationId, RegionName) +
Config: newStack(RegionName) +
`
resource "formancecloud_stack_module" "webhooks" {
name = "webhooks"
stack_id = formancecloud_stack.default.id
organization_id = data.formancecloud_organizations.default.id
}

provider "formancestack" {
stack_id = formancecloud_stack.default.id
organization_id = formancecloud_stack.default.organization_id
organization_id = data.formancecloud_current_organization.default.id
uri = formancecloud_stack.default.uri
}

Expand Down
Loading