Skip to content

Commit

Permalink
Merge pull request #352 from Qovery/feat/alan
Browse files Browse the repository at this point in the history
fix: add plan modifier on some resource id
  • Loading branch information
pggb25 committed Feb 9, 2024
2 parents 288e811 + 2f7d2cf commit 67e696f
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/hashicorp/terraform-plugin-log v0.9.0
github.com/hashicorp/terraform-plugin-sdk/v2 v2.29.0
github.com/pkg/errors v0.9.1
github.com/qovery/qovery-client-go v0.0.0-20240122163054-a54c8c23dbe7
github.com/qovery/qovery-client-go v0.0.0-20240208152258-b2701d4efe5d
github.com/schollz/progressbar/v3 v3.13.0
github.com/sethvargo/go-envconfig v0.9.0
github.com/stretchr/testify v1.8.4
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,10 @@ github.com/qovery/qovery-client-go v0.0.0-20240117130717-270362f9d2de h1:aA/AXIJ
github.com/qovery/qovery-client-go v0.0.0-20240117130717-270362f9d2de/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/qovery/qovery-client-go v0.0.0-20240122163054-a54c8c23dbe7 h1:0lTP8A8SODXcjG4AyFIoXXo2JKNa1uJzMeI0Q8eChvA=
github.com/qovery/qovery-client-go v0.0.0-20240122163054-a54c8c23dbe7/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/qovery/qovery-client-go v0.0.0-20240208090554-ddf5df2d3ca3 h1:1yJmYjOxnpjZ3YO4gRXs2bpu4OIF5cTqOQMAjR2Lddk=
github.com/qovery/qovery-client-go v0.0.0-20240208090554-ddf5df2d3ca3/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/qovery/qovery-client-go v0.0.0-20240208152258-b2701d4efe5d h1:E2zqZznSY/nWWXBgbSy8WC3lJHWecwTVliqT/w5tbEA=
github.com/qovery/qovery-client-go v0.0.0-20240208152258-b2701d4efe5d/go.mod h1:5QD7sC1Z6XCCYd31c4XKVwGdEOjvtgG0NDcaVDoWb+o=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw=
github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestNewDomainProjectFromQovery(t *testing.T) {
TestName: "success",
Project: &qovery.Project{
Id: gofakeit.UUID(),
Organization: &qovery.ReferenceObject{
Organization: qovery.ReferenceObject{
Id: gofakeit.UUID(),
},
Name: gofakeit.Name(),
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_aws_credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"strings"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -54,6 +56,9 @@ func (r awsCredentialsResource) Schema(_ context.Context, _ resource.SchemaReque
"id": schema.StringAttribute{
Description: "Id of the AWS credentials.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": schema.StringAttribute{
Description: "Id of the organization.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import (
"context"
_ "embed"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"strings"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -99,6 +101,9 @@ func (r clusterResource) Schema(_ context.Context, _ resource.SchemaRequest, res
"id": schema.StringAttribute{
Description: "Id of the cluster.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"credentials_id": schema.StringAttribute{
Description: "Id of the credentials.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_container_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"strings"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -59,6 +61,9 @@ func (r containerRegistryResource) Schema(_ context.Context, _ resource.SchemaRe
"id": schema.StringAttribute{
Description: "Id of the container registry.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": schema.StringAttribute{
Description: "Id of the organization.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_database.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
Expand Down Expand Up @@ -93,6 +95,9 @@ func (r databaseResource) Schema(_ context.Context, _ resource.SchemaRequest, re
"id": schema.StringAttribute{
Description: "Id of the database.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"environment_id": schema.StringAttribute{
Description: "Id of the environment.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_deployment_stage.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
Expand Down Expand Up @@ -53,6 +55,9 @@ func (r deploymentStageResource) Schema(_ context.Context, _ resource.SchemaRequ
"id": schema.StringAttribute{
Description: "Id of the deployment stage.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"environment_id": schema.StringAttribute{
Description: "Id of the environment.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/AlekSi/pointer"
"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -58,6 +60,9 @@ func (r environmentResource) Schema(_ context.Context, _ resource.SchemaRequest,
"id": schema.StringAttribute{
Description: "Id of the environment.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"project_id": schema.StringAttribute{
Description: "Id of the project.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_git_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"strings"

"github.com/hashicorp/terraform-plugin-framework/path"
Expand Down Expand Up @@ -59,6 +61,9 @@ func (r gitTokenResource) Schema(_ context.Context, _ resource.SchemaRequest, re
"id": schema.StringAttribute{
Description: "Id of the git token.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": schema.StringAttribute{
Description: "Id of the organization.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ import (
"github.com/hashicorp/terraform-plugin-framework/resource"
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setdefault"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringdefault"
"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/hashicorp/terraform-plugin-log/tflog"
Expand Down Expand Up @@ -64,6 +66,9 @@ func (r helmResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *
"id": schema.StringAttribute{
Description: "Id of the helm.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"environment_id": schema.StringAttribute{
Description: "Id of the environment.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_helm_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
"github.com/qovery/terraform-provider-qovery/internal/domain/helmRepository"
"strings"

Expand Down Expand Up @@ -59,6 +61,9 @@ func (r helmRepositoryResource) Schema(_ context.Context, _ resource.SchemaReque
"id": schema.StringAttribute{
Description: "Id of the helm repository.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": schema.StringAttribute{
Description: "Id of the organization.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/hashicorp/terraform-plugin-framework/resource/schema"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/int64default"
Expand Down Expand Up @@ -63,6 +65,9 @@ func (r jobResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *r
"id": schema.StringAttribute{
Description: "Id of the job.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"environment_id": schema.StringAttribute{
Description: "Id of the environment.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
Expand Down Expand Up @@ -58,6 +60,9 @@ func (r organizationResource) Schema(_ context.Context, _ resource.SchemaRequest
"id": schema.StringAttribute{
Description: "Id of the organization.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"name": schema.StringAttribute{
Description: "Name of the organization.",
Expand Down
5 changes: 5 additions & 0 deletions qovery/resource_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package qovery
import (
"context"
"fmt"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"

"github.com/hashicorp/terraform-plugin-framework/path"
"github.com/hashicorp/terraform-plugin-framework/resource"
Expand Down Expand Up @@ -53,6 +55,9 @@ func (r projectResource) Schema(_ context.Context, _ resource.SchemaRequest, res
"id": schema.StringAttribute{
Description: "Id of the project.",
Computed: true,
PlanModifiers: []planmodifier.String{
stringplanmodifier.UseStateForUnknown(),
},
},
"organization_id": schema.StringAttribute{
Description: "Id of the organization.",
Expand Down

0 comments on commit 67e696f

Please sign in to comment.