From e2fa5d8c5a7bc5e8721535f5156e715809133052 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Fri, 22 Mar 2024 17:53:16 +0100 Subject: [PATCH] Fix: Removed required organization ID --- .../resources/infisical_project/resource.tf | 15 +++++------ infisical/provider/project_resource.go | 25 ++++--------------- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/examples/resources/infisical_project/resource.tf b/examples/resources/infisical_project/resource.tf index a6352a4..a002ad6 100644 --- a/examples/resources/infisical_project/resource.tf +++ b/examples/resources/infisical_project/resource.tf @@ -14,21 +14,18 @@ provider "infisical" { } resource "infisical_project" "gcp-project" { - name = "GCP Project" - slug = "gcp-project" - organization_slug = "" + name = "GCP Project" + slug = "gcp-project" } resource "infisical_project" "aws-project" { - name = "AWS Project" - slug = "aws-project" - organization_slug = "" + name = "AWS Project" + slug = "aws-project" } resource "infisical_project" "azure-project" { - name = "Azure Project" - slug = "azure-project" - organization_slug = "" + name = "Azure Project" + slug = "azure-project" } diff --git a/infisical/provider/project_resource.go b/infisical/provider/project_resource.go index 7b9a36b..2b746ab 100644 --- a/infisical/provider/project_resource.go +++ b/infisical/provider/project_resource.go @@ -28,10 +28,9 @@ type projectResource struct { // projectResourceSourceModel describes the data source data model. type projectResourceModel struct { - Slug types.String `tfsdk:"slug"` - OrganizationSlug types.String `tfsdk:"organization_slug"` - Name types.String `tfsdk:"name"` - LastUpdated types.String `tfsdk:"last_updated"` + Slug types.String `tfsdk:"slug"` + Name types.String `tfsdk:"name"` + LastUpdated types.String `tfsdk:"last_updated"` } // Metadata returns the resource type name. @@ -48,10 +47,6 @@ func (r *projectResource) Schema(_ context.Context, _ resource.SchemaRequest, re Description: "The slug of the project", Required: true, }, - "organization_slug": schema.StringAttribute{ - Description: "The slug of the organization to which the project belongs", - Required: true, - }, "name": schema.StringAttribute{ Description: "The name of the project", Required: true, @@ -103,9 +98,8 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest } _, err := r.client.CallCreateProject(infisical.CreateProjectRequest{ - OrganizationSlug: plan.OrganizationSlug.ValueString(), - ProjectName: plan.Name.ValueString(), - Slug: plan.Slug.ValueString(), + ProjectName: plan.Name.ValueString(), + Slug: plan.Slug.ValueString(), }) if err != nil { @@ -118,7 +112,6 @@ func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850)) plan.Slug = types.StringValue(plan.Slug.ValueString()) - plan.OrganizationSlug = types.StringValue(plan.OrganizationSlug.ValueString()) plan.Name = types.StringValue(plan.Name.ValueString()) diags = resp.State.Set(ctx, plan) @@ -205,14 +198,6 @@ func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest return } - if state.OrganizationSlug != plan.OrganizationSlug { - resp.Diagnostics.AddError( - "Unable to update project", - "Organization slug cannot be updated", - ) - return - } - _, err := r.client.CallUpdateProject(infisical.UpdateProjectRequest{ ProjectName: plan.Name.ValueString(), Slug: plan.Slug.ValueString(),