Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add project secret property #9

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/data-sources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions docs/resources/project.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions internal/mixpanel/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions internal/provider/project_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ func (d *ProjectDataSource) Schema(_ context.Context, _ datasource.SchemaRequest
Computed: true,
Sensitive: true,
},
"secret": schema.StringAttribute{
Computed: true,
Sensitive: true,
},
},
}
}
Expand All @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions internal/provider/project_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ func (r *projectResource) Schema(_ context.Context, _ resource.SchemaRequest, re
Computed: true,
Sensitive: true,
},
"secret": schema.StringAttribute{
Computed: true,
Sensitive: true,
},
},
}
}
Expand Down Expand Up @@ -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),
}
}