From e8852f04a2beec29611a5b72a140f05b4ccb0056 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 | 1 + docs/resources/project.md | 1 + internal/mixpanel/project.go | 2 ++ internal/provider/project_data_source.go | 5 +++++ internal/provider/project_resource.go | 5 +++++ 5 files changed, 14 insertions(+) diff --git a/docs/data-sources/project.md b/docs/data-sources/project.md index b926ab0..027f4fc 100644 --- a/docs/data-sources/project.md +++ b/docs/data-sources/project.md @@ -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..ade3b1f 100644 --- a/docs/resources/project.md +++ b/docs/resources/project.md @@ -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), } }