diff --git a/client/api.go b/client/api.go index e9b2992..09da811 100644 --- a/client/api.go +++ b/client/api.go @@ -268,3 +268,89 @@ func (client Client) CallGetSingleRawSecretByNameV3(request GetSingleSecretByNam return secretsResponse, nil } + +func (client Client) CallCreateProject(request CreateProjectRequest) (CreateProjectResponse, error) { + + if request.Slug == "" { + request = CreateProjectRequest{ + ProjectName: request.ProjectName, + OrganizationSlug: request.OrganizationSlug, + } + } + + var projectResponse CreateProjectResponse + response, err := client.Config.HttpClient. + R(). + SetResult(&projectResponse). + SetHeader("User-Agent", USER_AGENT). + SetBody(request). + Post("api/v2/workspace") + + if err != nil { + return CreateProjectResponse{}, fmt.Errorf("CallCreateProject: Unable to complete api request [err=%s]", err) + } + + if response.IsError() { + return CreateProjectResponse{}, fmt.Errorf("CallCreateProject: Unsuccessful response. [response=%s]", response) + } + + return projectResponse, nil +} + +func (client Client) CallDeleteProject(request DeleteProjectRequest) error { + var projectResponse DeleteProjectResponse + response, err := client.Config.HttpClient. + R(). + SetResult(&projectResponse). + SetHeader("User-Agent", USER_AGENT). + Delete(fmt.Sprintf("api/v2/workspace/%s", request.Slug)) + + if err != nil { + return fmt.Errorf("CallDeleteProject: Unable to complete api request [err=%s]", err) + } + + if response.IsError() { + return fmt.Errorf("CallDeleteProject: Unsuccessful response. [response=%s]", response) + } + + return nil +} + +func (client Client) CallGetProject(request GetProjectRequest) (ProjectWithEnvironments, error) { + var projectResponse ProjectWithEnvironments + response, err := client.Config.HttpClient. + R(). + SetResult(&projectResponse). + SetHeader("User-Agent", USER_AGENT). + Get(fmt.Sprintf("api/v2/workspace/%s", request.Slug)) + + if err != nil { + return ProjectWithEnvironments{}, fmt.Errorf("CallGetProject: Unable to complete api request [err=%s]", err) + } + + if response.IsError() { + return ProjectWithEnvironments{}, fmt.Errorf("CallGetProject: Unsuccessful response. [response=%s]", response) + } + + return projectResponse, nil +} + +func (client Client) CallUpdateProject(request UpdateProjectRequest) (UpdateProjectResponse, error) { + var projectResponse UpdateProjectResponse + response, err := client.Config.HttpClient. + R(). + SetResult(&projectResponse). + SetHeader("User-Agent", USER_AGENT). + SetBody(request). + Patch(fmt.Sprintf("api/v2/workspace/%s", request.Slug)) + + if err != nil { + return UpdateProjectResponse{}, fmt.Errorf("CallUpdateProject: Unable to complete api request [err=%s]", err) + } + + if response.IsError() { + return UpdateProjectResponse{}, fmt.Errorf("CallUpdateProject: Unsuccessful response. [response=%s]", response) + } + + return projectResponse, nil +} diff --git a/client/model.go b/client/model.go index eba6102..5c2e812 100644 --- a/client/model.go +++ b/client/model.go @@ -37,6 +37,48 @@ type EncryptedSecretV3 struct { UpdatedAt time.Time `json:"updatedAt"` } +type Project struct { + ID string `json:"id"` + Name string `json:"name"` + Slug string `json:"slug"` + AutoCapitalization bool `json:"autoCapitalization"` + OrgID string `json:"orgId"` + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + Version int `json:"version"` + + UpgradeStatus string `json:"upgradeStatus"` // can be null. if its null it will be converted to an empty string. +} + +type ProjectWithEnvironments struct { + ID string `json:"id"` + Name string `json:"name"` + Slug string `json:"slug"` + AutoCapitalization bool `json:"autoCapitalization"` + OrgID string `json:"orgId"` + CreatedAt string `json:"createdAt"` + UpdatedAt string `json:"updatedAt"` + Version int64 `json:"version"` + UpgradeStatus string `json:"upgradeStatus"` + Environments []ProjectEnvironment `json:"environments"` +} + +type ProjectEnvironment struct { + Name string `json:"name"` + Slug string `json:"slug"` + ID string `json:"id"` +} + +type CreateProjectResponse struct { + Project Project `json:"project"` +} + +type DeleteProjectResponse struct { + Project Project `json:"workspace"` +} + +type UpdateProjectResponse Project + type GetEncryptedSecretsV3Response struct { Secrets []EncryptedSecretV3 `json:"secrets"` } @@ -232,3 +274,22 @@ type UpdateRawSecretByNameV3Request struct { SecretPath string `json:"secretPath"` SecretValue string `json:"secretValue"` } + +type CreateProjectRequest struct { + ProjectName string `json:"projectName"` + Slug string `json:"slug"` + OrganizationSlug string `json:"organizationSlug"` +} + +type DeleteProjectRequest struct { + Slug string `json:"slug"` +} + +type GetProjectRequest struct { + Slug string `json:"slug"` +} + +type UpdateProjectRequest struct { + Slug string `json:"slug"` + ProjectName string `json:"name"` +} diff --git a/docs/data-sources/projects.md b/docs/data-sources/projects.md new file mode 100644 index 0000000..f629772 --- /dev/null +++ b/docs/data-sources/projects.md @@ -0,0 +1,72 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "infisical_projects Data Source - terraform-provider-infisical" +subcategory: "" +description: |- + Interact with Infisical projects. Only Machine Identity authentication is supported for this data source. +--- + +# infisical_projects (Data Source) + +Interact with Infisical projects. Only Machine Identity authentication is supported for this data source. + +## Example Usage + +```terraform +terraform { + required_providers { + infisical = { + # version = + source = "infisical/infisical" + } + } +} + +provider "infisical" { + host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com + client_id = "" + client_secret = "" +} + +data "infisical_projects" "test-project" { + slug = "" +} + +// Get the value of the "dev" environment +output "dev-environment" { + value = data.infisical_projects.test-project.environments["dev"] +} + +// Get the entire project +output "entire-project" { + value = data.infisical_projects.test-project +} +``` + + +## Schema + +### Required + +- `slug` (String) The slug of the project to fetch + +### Read-Only + +- `auto_capitalization` (Boolean) The auto capitalization status of the project +- `created_at` (String) The creation date of the project +- `environments` (Attributes Map) (see [below for nested schema](#nestedatt--environments)) +- `id` (String) The ID of the project +- `name` (String) The name of the project +- `org_id` (String) The ID of the organization to which the project belongs +- `updated_at` (String) The last update date of the project +- `upgrade_status` (String) The upgrade status of the project +- `version` (Number) The version of the project + + +### Nested Schema for `environments` + +Read-Only: + +- `id` (String) The ID of the environment +- `name` (String) The name of the environment +- `slug` (String) The slug of the environment diff --git a/docs/data-sources/secrets.md b/docs/data-sources/secrets.md index 64e5534..529d690 100644 --- a/docs/data-sources/secrets.md +++ b/docs/data-sources/secrets.md @@ -3,12 +3,12 @@ page_title: "infisical_secrets Data Source - terraform-provider-infisical" subcategory: "" description: |- - Get secrets from Infisical + Interact with Infisical secrets --- # infisical_secrets (Data Source) -Get secrets from Infisical +Interact with Infisical secrets ## Example Usage diff --git a/docs/resources/project.md b/docs/resources/project.md new file mode 100644 index 0000000..2712a22 --- /dev/null +++ b/docs/resources/project.md @@ -0,0 +1,57 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "infisical_project Resource - terraform-provider-infisical" +subcategory: "" +description: |- + Create projects & save to Infisical. Only Machine Identity authentication is supported for this data source. +--- + +# infisical_project (Resource) + +Create projects & save to Infisical. Only Machine Identity authentication is supported for this data source. + +## Example Usage + +```terraform +terraform { + required_providers { + infisical = { + # version = + source = "infisical/infisical" + } + } +} + +provider "infisical" { + host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com + client_id = "" + client_secret = "" +} + +resource "infisical_project" "gcp-project" { + name = "GCP Project" + slug = "gcp-project" +} + +resource "infisical_project" "aws-project" { + name = "AWS Project" + slug = "aws-project" +} + +resource "infisical_project" "azure-project" { + name = "Azure Project" + slug = "azure-project" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the project +- `slug` (String) The slug of the project + +### Read-Only + +- `last_updated` (String) diff --git a/examples/data-sources/infisical_projects/data-source.tf b/examples/data-sources/infisical_projects/data-source.tf new file mode 100644 index 0000000..c04ac1f --- /dev/null +++ b/examples/data-sources/infisical_projects/data-source.tf @@ -0,0 +1,28 @@ +terraform { + required_providers { + infisical = { + # version = + source = "infisical/infisical" + } + } +} + +provider "infisical" { + host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com + client_id = "" + client_secret = "" +} + +data "infisical_projects" "test-project" { + slug = "" +} + +// Get the value of the "dev" environment +output "dev-environment" { + value = data.infisical_projects.test-project.environments["dev"] +} + +// Get the entire project +output "entire-project" { + value = data.infisical_projects.test-project +} diff --git a/examples/resources/infisical_project/resource.tf b/examples/resources/infisical_project/resource.tf new file mode 100644 index 0000000..a002ad6 --- /dev/null +++ b/examples/resources/infisical_project/resource.tf @@ -0,0 +1,31 @@ +terraform { + required_providers { + infisical = { + # version = + source = "infisical/infisical" + } + } +} + +provider "infisical" { + host = "https://app.infisical.com" # Only required if using self hosted instance of Infisical, default is https://app.infisical.com + client_id = "" + client_secret = "" +} + +resource "infisical_project" "gcp-project" { + name = "GCP Project" + slug = "gcp-project" +} + +resource "infisical_project" "aws-project" { + name = "AWS Project" + slug = "aws-project" +} + +resource "infisical_project" "azure-project" { + name = "Azure Project" + slug = "azure-project" +} + + diff --git a/infisical/provider/project_resource.go b/infisical/provider/project_resource.go new file mode 100644 index 0000000..2b746ab --- /dev/null +++ b/infisical/provider/project_resource.go @@ -0,0 +1,255 @@ +package provider + +import ( + "context" + "fmt" + infisical "terraform-provider-infisical/client" + "time" + + "github.com/hashicorp/terraform-plugin-framework/resource" + "github.com/hashicorp/terraform-plugin-framework/resource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +// Ensure the implementation satisfies the expected interfaces. +var ( + _ resource.Resource = &projectResource{} +) + +// NewProjectResource is a helper function to simplify the provider implementation. +func NewProjectResource() resource.Resource { + return &projectResource{} +} + +// projectResource is the resource implementation. +type projectResource struct { + client *infisical.Client +} + +// projectResourceSourceModel describes the data source data model. +type projectResourceModel struct { + Slug types.String `tfsdk:"slug"` + Name types.String `tfsdk:"name"` + LastUpdated types.String `tfsdk:"last_updated"` +} + +// Metadata returns the resource type name. +func (r *projectResource) Metadata(_ context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_project" +} + +// Schema defines the schema for the resource. +func (r *projectResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) { + resp.Schema = schema.Schema{ + Description: "Create projects & save to Infisical. Only Machine Identity authentication is supported for this data source.", + Attributes: map[string]schema.Attribute{ + "slug": schema.StringAttribute{ + Description: "The slug of the project", + Required: true, + }, + "name": schema.StringAttribute{ + Description: "The name of the project", + Required: true, + }, + + "last_updated": schema.StringAttribute{ + Computed: true, + }, + }, + } +} + +// Configure adds the provider configured client to the resource. +func (r *projectResource) Configure(_ context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse) { + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*infisical.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + r.client = client +} + +// Create creates the resource and sets the initial Terraform state. +func (r *projectResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) { + if r.client.Config.AuthStrategy != infisical.AuthStrategy.UNIVERSAL_MACHINE_IDENTITY { + resp.Diagnostics.AddError( + "Unable to create project", + "Only Machine Identity authentication is supported for this operation", + ) + return + } + + // Retrieve values from plan + var plan projectResourceModel + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + _, err := r.client.CallCreateProject(infisical.CreateProjectRequest{ + ProjectName: plan.Name.ValueString(), + Slug: plan.Slug.ValueString(), + }) + + if err != nil { + resp.Diagnostics.AddError( + "Error creating project", + "Couldn't save project to Infiscial, unexpected error: "+err.Error(), + ) + return + } + + plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850)) + plan.Slug = types.StringValue(plan.Slug.ValueString()) + plan.Name = types.StringValue(plan.Name.ValueString()) + + diags = resp.State.Set(ctx, plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + +} + +// Read refreshes the Terraform state with the latest data. +func (r *projectResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse) { + if r.client.Config.AuthStrategy != infisical.AuthStrategy.UNIVERSAL_MACHINE_IDENTITY { + resp.Diagnostics.AddError( + "Unable to read project", + "Only Machine Identity authentication is supported for this operation", + ) + return + } + + // Get current state + var state projectResourceModel + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + // Get the latest data from the API + project, err := r.client.CallGetProject(infisical.GetProjectRequest{ + Slug: state.Slug.ValueString(), + }) + + if err != nil { + resp.Diagnostics.AddError( + "Error reading project", + "Couldn't read project from Infiscial, unexpected error: "+err.Error(), + ) + return + } + + if state.Name.ValueString() != project.Name { + state.Name = types.StringValue(project.Name) + } + + diags = resp.State.Set(ctx, state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + +} + +// Update updates the resource and sets the updated Terraform state on success. +func (r *projectResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { + if r.client.Config.AuthStrategy != infisical.AuthStrategy.UNIVERSAL_MACHINE_IDENTITY { + resp.Diagnostics.AddError( + "Unable to update project", + "Only Machine Identity authentication is supported for this operation", + ) + return + } + + // Retrieve values from plan + var plan projectResourceModel + diags := req.Plan.Get(ctx, &plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + var state projectResourceModel + diags = req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + if state.Slug != plan.Slug { + resp.Diagnostics.AddError( + "Unable to update project", + "Slug cannot be updated", + ) + return + } + + _, err := r.client.CallUpdateProject(infisical.UpdateProjectRequest{ + ProjectName: plan.Name.ValueString(), + Slug: plan.Slug.ValueString(), + }) + + if err != nil { + resp.Diagnostics.AddError( + "Error updating project", + "Couldn't update project from Infiscial, unexpected error: "+err.Error(), + ) + return + } + + plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850)) + plan.Name = types.StringValue(plan.Name.ValueString()) + + diags = resp.State.Set(ctx, plan) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + +} + +// Delete deletes the resource and removes the Terraform state on success. +func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) { + + if r.client.Config.AuthStrategy != infisical.AuthStrategy.UNIVERSAL_MACHINE_IDENTITY { + resp.Diagnostics.AddError( + "Unable to delete project", + "Only Machine Identity authentication is supported for this operation", + ) + return + } + + var state projectResourceModel + diags := req.State.Get(ctx, &state) + resp.Diagnostics.Append(diags...) + if resp.Diagnostics.HasError() { + return + } + + err := r.client.CallDeleteProject(infisical.DeleteProjectRequest{ + Slug: state.Slug.ValueString(), + }) + + if err != nil { + resp.Diagnostics.AddError( + "Error deleting project", + "Couldn't delete project from Infiscial, unexpected error: "+err.Error(), + ) + return + } + +} diff --git a/infisical/provider/projects_data_source.go b/infisical/provider/projects_data_source.go new file mode 100644 index 0000000..1c2bc07 --- /dev/null +++ b/infisical/provider/projects_data_source.go @@ -0,0 +1,201 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + +package provider + +import ( + "context" + "fmt" + + infisical "terraform-provider-infisical/client" + + "github.com/hashicorp/terraform-plugin-framework/datasource" + "github.com/hashicorp/terraform-plugin-framework/datasource/schema" + "github.com/hashicorp/terraform-plugin-framework/types" +) + +// Ensure provider defined types fully satisfy framework interfaces. +var _ datasource.DataSource = &ProjectsDataSource{} + +func NewProjectDataSource() datasource.DataSource { + return &ProjectsDataSource{} +} + +// SecretDataSource defines the data source implementation. +type ProjectsDataSource struct { + client *infisical.Client +} + +// ExampleDataSourceModel describes the data source data model. +type ProjectDataSourceModel struct { + ID types.String `tfsdk:"id"` + Name types.String `tfsdk:"name"` + Slug types.String `tfsdk:"slug"` + AutoCapitalization types.Bool `tfsdk:"auto_capitalization"` + OrgID types.String `tfsdk:"org_id"` + CreatedAt types.String `tfsdk:"created_at"` + UpdatedAt types.String `tfsdk:"updated_at"` + Version types.Int64 `tfsdk:"version"` + UpgradeStatus types.String `tfsdk:"upgrade_status"` + Environments map[string]ProjectEnvironmentDetails `tfsdk:"environments"` +} + +type ProjectEnvironmentDetails struct { + Name types.String `tfsdk:"name"` + Slug types.String `tfsdk:"slug"` + ID types.String `tfsdk:"id"` +} + +func (d *ProjectsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) { + resp.TypeName = req.ProviderTypeName + "_projects" +} + +func (d *ProjectsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { + resp.Schema = schema.Schema{ + Description: "Interact with Infisical projects. Only Machine Identity authentication is supported for this data source.", + + Attributes: map[string]schema.Attribute{ + "slug": schema.StringAttribute{ + Description: "The slug of the project to fetch", + Required: true, + }, + + "id": schema.StringAttribute{ + Description: "The ID of the project", + Computed: true, + }, + + "name": schema.StringAttribute{ + Description: "The name of the project", + Computed: true, + }, + + "auto_capitalization": schema.BoolAttribute{ + Description: "The auto capitalization status of the project", + Computed: true, + }, + + "org_id": schema.StringAttribute{ + Description: "The ID of the organization to which the project belongs", + Computed: true, + }, + + "created_at": schema.StringAttribute{ + Description: "The creation date of the project", + Computed: true, + }, + + "updated_at": schema.StringAttribute{ + Description: "The last update date of the project", + Computed: true, + }, + + "version": schema.Int64Attribute{ + Description: "The version of the project", + Computed: true, + }, + + "upgrade_status": schema.StringAttribute{ + Description: "The upgrade status of the project", + Computed: true, + }, + + "environments": schema.MapNestedAttribute{ + Computed: true, + NestedObject: schema.NestedAttributeObject{ + Attributes: map[string]schema.Attribute{ + "name": schema.StringAttribute{ + Description: "The name of the environment", + Computed: true, + }, + "slug": schema.StringAttribute{ + Description: "The slug of the environment", + Computed: true, + }, + "id": schema.StringAttribute{ + Description: "The ID of the environment", + Computed: true, + }, + }, + }, + }, + }, + } +} + +func (d *ProjectsDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse) { + // Prevent panic if the provider has not been configured. + if req.ProviderData == nil { + return + } + + client, ok := req.ProviderData.(*infisical.Client) + + if !ok { + resp.Diagnostics.AddError( + "Unexpected Data Source Configure Type", + fmt.Sprintf("Expected *http.Client, got: %T. Please report this issue to the provider developers.", req.ProviderData), + ) + + return + } + + d.client = client +} + +func (d *ProjectsDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse) { + + if d.client.Config.AuthStrategy != infisical.AuthStrategy.UNIVERSAL_MACHINE_IDENTITY { + resp.Diagnostics.AddError( + "Unable to create project", + "Only Machine Identity authentication is supported for this operation", + ) + return + } + + var data ProjectDataSourceModel + + // Read Terraform configuration data into the model + resp.Diagnostics.Append(req.Config.Get(ctx, &data)...) + + if resp.Diagnostics.HasError() { + return + } + + project, err := d.client.CallGetProject(infisical.GetProjectRequest{ + Slug: data.Slug.ValueString(), + }) + if err != nil { + resp.Diagnostics.AddError( + "Something went wrong while fetching the project", + "If the error is not clear, please get in touch at infisical.com/slack\n\n"+ + "Infisical Client Error: "+err.Error(), + ) + } + + data = ProjectDataSourceModel{ + ID: types.StringValue(project.ID), + Name: types.StringValue(project.Name), + Slug: types.StringValue(project.Slug), + AutoCapitalization: types.BoolValue(project.AutoCapitalization), + OrgID: types.StringValue(project.OrgID), + CreatedAt: types.StringValue(project.CreatedAt), + UpdatedAt: types.StringValue(project.UpdatedAt), + Version: types.Int64Value(project.Version), + UpgradeStatus: types.StringValue(project.UpgradeStatus), + Environments: data.Environments, + } + + data.Environments = make(map[string]ProjectEnvironmentDetails) + + for _, env := range project.Environments { + data.Environments[env.Slug] = ProjectEnvironmentDetails{ + Name: types.StringValue(env.Name), + Slug: types.StringValue(env.Slug), + ID: types.StringValue(env.ID), + } + } + + // Save data into Terraform state + resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) +} diff --git a/infisical/provider/provider.go b/infisical/provider/provider.go index 37e3258..e77f3ab 100644 --- a/infisical/provider/provider.go +++ b/infisical/provider/provider.go @@ -150,6 +150,7 @@ func (p *infisicalProvider) Configure(ctx context.Context, req provider.Configur func (p *infisicalProvider) DataSources(_ context.Context) []func() datasource.DataSource { return []func() datasource.DataSource{ NewSecretDataSource, + NewProjectDataSource, } } @@ -157,5 +158,6 @@ func (p *infisicalProvider) DataSources(_ context.Context) []func() datasource.D func (p *infisicalProvider) Resources(_ context.Context) []func() resource.Resource { return []func() resource.Resource{ NewSecretResource, + NewProjectResource, } } diff --git a/infisical/provider/secret_resource.go b/infisical/provider/secret_resource.go index 2bf1081..f290ced 100644 --- a/infisical/provider/secret_resource.go +++ b/infisical/provider/secret_resource.go @@ -224,7 +224,6 @@ func (r *secretResource) Create(ctx context.Context, req resource.CreateRequest, return } plan.LastUpdated = types.StringValue(time.Now().Format(time.RFC850)) - diags = resp.State.Set(ctx, plan) resp.Diagnostics.Append(diags...) if resp.Diagnostics.HasError() { diff --git a/infisical/provider/secrets_data_source.go b/infisical/provider/secrets_data_source.go index 9efaebf..03982e1 100644 --- a/infisical/provider/secrets_data_source.go +++ b/infisical/provider/secrets_data_source.go @@ -46,7 +46,7 @@ func (d *SecretsDataSource) Metadata(ctx context.Context, req datasource.Metadat func (d *SecretsDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - Description: "Get secrets from Infisical", + Description: "Interact with Infisical secrets", Attributes: map[string]schema.Attribute{ "folder_path": schema.StringAttribute{