From 5886fec3ded7000ceb5a926b423cd15b27c6c54b Mon Sep 17 00:00:00 2001 From: Kilian Decaderincourt Date: Mon, 16 Sep 2024 15:13:12 +0200 Subject: [PATCH] feat: add project secret property --- docs/data-sources/project.md | 3 ++- docs/resources/project.md | 3 ++- internal/mixpanel/project.go | 2 ++ internal/provider/project_data_source.go | 5 +++++ internal/provider/project_resource.go | 5 +++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/docs/data-sources/project.md b/docs/data-sources/project.md index b926ab0..123ae5f 100644 --- a/docs/data-sources/project.md +++ b/docs/data-sources/project.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "mixpanel_project Data Source - mixpanel" +page_title: "mixpanel_project Data Source - terraform-provider-mixpanel" subcategory: "" description: |- @@ -27,5 +27,6 @@ data "mixpanel_project" "project" { - `domain` (String) - `id` (Number) The ID of this resource. - `name` (String) +- `secret` (String, Sensitive) - `timezone` (String) - `token` (String, Sensitive) diff --git a/docs/resources/project.md b/docs/resources/project.md index 2501978..8dd1371 100644 --- a/docs/resources/project.md +++ b/docs/resources/project.md @@ -1,6 +1,6 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "mixpanel_project Resource - mixpanel" +page_title: "mixpanel_project Resource - terraform-provider-mixpanel" subcategory: "" description: |- @@ -33,6 +33,7 @@ resource "mixpanel_project" "myproject" { - `api_key` (String, Sensitive) - `id` (Number) The ID of this resource. +- `secret` (String, Sensitive) - `token` (String, Sensitive) ## Import diff --git a/internal/mixpanel/project.go b/internal/mixpanel/project.go index 2a888ee..280e617 100644 --- a/internal/mixpanel/project.go +++ b/internal/mixpanel/project.go @@ -20,6 +20,7 @@ type Project struct { Timezone string `json:"timezone_name"` ApiKey string `json:"api_key"` Token string `json:"token"` + Secret string `json:"secret"` } type ProjectResponse struct { @@ -34,6 +35,7 @@ type ProjectResponseResults struct { Timezone string `json:"timezone_name"` ApiKey string `json:"api_key"` Token string `json:"token"` + Secret string `json:"secret"` } func (c *Client) GetProject(id int64) (*Project, error) { diff --git a/internal/provider/project_data_source.go b/internal/provider/project_data_source.go index 362e174..87ed9c0 100644 --- a/internal/provider/project_data_source.go +++ b/internal/provider/project_data_source.go @@ -59,6 +59,10 @@ func (d *ProjectDataSource) Schema(_ context.Context, _ datasource.SchemaRequest Computed: true, Sensitive: true, }, + "secret": schema.StringAttribute{ + Computed: true, + Sensitive: true, + }, }, } } @@ -70,6 +74,7 @@ type ProjectModel struct { Timezone basetypes.StringValue `tfsdk:"timezone"` ApiKey basetypes.StringValue `tfsdk:"api_key"` Token basetypes.StringValue `tfsdk:"token"` + Secret basetypes.StringValue `tfsdk:"secret"` } // Read refreshes the Terraform state with the latest data. diff --git a/internal/provider/project_resource.go b/internal/provider/project_resource.go index 73c913b..4eedf2e 100644 --- a/internal/provider/project_resource.go +++ b/internal/provider/project_resource.go @@ -90,6 +90,10 @@ func (r *projectResource) Schema(_ context.Context, _ resource.SchemaRequest, re Computed: true, Sensitive: true, }, + "secret": schema.StringAttribute{ + Computed: true, + Sensitive: true, + }, }, } } @@ -252,5 +256,6 @@ func ProjectToProjectModel(project *mixpanel.Project) ProjectModel { Timezone: basetypes.NewStringValue(project.Timezone), ApiKey: basetypes.NewStringValue(project.ApiKey), Token: basetypes.NewStringValue(project.Token), + Secret: basetypes.NewStringValue(project.Secret), } }