Skip to content

Commit

Permalink
Fix/tag prefix module (#101)
Browse files Browse the repository at this point in the history
* fix: update docs with some details

* run go generate

* fix: add tagprefix in api call

* fix: fix module tag prefix

* fix: log message

* fix: print statement

* remove terraform provider terrakube binary
  • Loading branch information
BenjaminDecreusefond authored Feb 10, 2025
1 parent 34706b6 commit 2f1b332
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
14 changes: 13 additions & 1 deletion docs/resources/workspace_access.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,19 @@ description: |-

Manage workspace access.


## Example Usage

```terraform
resource "terrakube_workspace_access" "workspace_access" {
name = "my_terrakube_team"
organization_id = "my_organization_id"
workspace_id = "my_workspace_id"
manage_job = true
manage_state = false
manage_workspace = false
}
```

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down
9 changes: 9 additions & 0 deletions examples/resources/terrakube_workspace_access/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "terrakube_workspace_access" "workspace_access" {
name = "my_terrakube_team"
organization_id = "my_organization_id"
workspace_id = "my_workspace_id"

manage_job = true
manage_state = false
manage_workspace = false
}
6 changes: 3 additions & 3 deletions internal/provider/module_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ func (r *ModuleResource) Create(ctx context.Context, req resource.CreateRequest,
}

if !plan.TagPrefix.IsNull() {
tflog.Info(ctx, fmt.Sprintf("Module using Tag Prefix: %s", plan.VcsId.ValueString()))
bodyRequest.Vcs = &client.VcsEntity{ID: plan.VcsId.ValueString()}
tflog.Info(ctx, fmt.Sprintf("Module using Tag Prefix: %s", *plan.TagPrefix.ValueStringPointer()))
bodyRequest.TagPrefix = plan.TagPrefix.ValueStringPointer()
}

if !plan.VcsId.IsNull() {
Expand Down Expand Up @@ -327,7 +327,7 @@ func (r *ModuleResource) Update(ctx context.Context, req resource.UpdateRequest,
}

if !plan.TagPrefix.IsNull() {
tflog.Info(ctx, fmt.Sprintf("Module using Vcs connection id: %s", plan.VcsId.ValueString()))
tflog.Info(ctx, fmt.Sprintf("Module using Tag Prefix: %s", *plan.TagPrefix.ValueStringPointer()))
bodyRequest.TagPrefix = plan.TagPrefix.ValueStringPointer()
}

Expand Down
5 changes: 0 additions & 5 deletions internal/provider/workspace_webhook_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ func (r *WorkspaceWebhookResource) Metadata(ctx context.Context, req resource.Me
}

func (r *WorkspaceWebhookResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Diagnostics.AddWarning(
"WARNING",
"In its current implementation, Terrakube creates "+
"one webhook for each instance of this resource and github has a default limitation of 20 webhooks per repository.",
)
resp.Schema = schema.Schema{
MarkdownDescription: "Create a webhook attached to a workspace. Can be useful for automated apply/plan workflows.",

Expand Down

0 comments on commit 2f1b332

Please sign in to comment.