Skip to content

Commit

Permalink
feat: add project secret property
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiliandeca committed Sep 16, 2024
1 parent 097c46b commit e8852f0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
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),
}
}

0 comments on commit e8852f0

Please sign in to comment.