Skip to content

Commit

Permalink
feat: Adding support to manage self hosted agents (#89)
Browse files Browse the repository at this point in the history
  • Loading branch information
alfespa17 authored Nov 15, 2024
1 parent 293927b commit 7a8839c
Show file tree
Hide file tree
Showing 6 changed files with 414 additions and 0 deletions.
45 changes: 45 additions & 0 deletions docs/resources/self_hosted_agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "terrakube_self_hosted_agent Resource - terrakube"
subcategory: ""
description: |-
Resource for managing self hosted agents in Terrakube. This resource allows you to create, read, update, and delete self hosted agents within a specified organization.
---

# terrakube_self_hosted_agent (Resource)

Resource for managing self hosted agents in Terrakube. This resource allows you to create, read, update, and delete self hosted agents within a specified organization.

## Example Usage

```terraform
resource "terrakube_self_hosted_agent" "collection" {
name = "MY-SUPER-AGENT"
organization_id = data.terrakube_organization.org.id
description = "Hello World!"
url = "http://localhost:8090"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `description` (String) Description of the self hosted agent
- `name` (String) Self hosted agent name
- `organization_id` (String) Terrakube organization id
- `url` (String) Url of the self hosted agent

### Read-Only

- `id` (String) Agent Id

## Import

Import is supported using the following syntax:

```shell
# Collection can be import with organization_id,id
terraform import terrakube_self_hosted_agent.example 00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000
```
2 changes: 2 additions & 0 deletions examples/resources/terrakube_self_hosted_agent/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Collection can be import with organization_id,id
terraform import terrakube_self_hosted_agent.example 00000000-0000-0000-0000-000000000000,00000000-0000-0000-0000-000000000000
6 changes: 6 additions & 0 deletions examples/resources/terrakube_self_hosted_agent/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "terrakube_self_hosted_agent" "collection" {
name = "MY-SUPER-AGENT"
organization_id = data.terrakube_organization.org.id
description = "Hello World!"
url = "http://localhost:8090"
}
7 changes: 7 additions & 0 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ type CollectionEntity struct {
Priority int32 `jsonapi:"attr,priority"`
}

type AgentEntity struct {
ID string `jsonapi:"primary,agent"`
Name string `jsonapi:"attr,name"`
Description string `jsonapi:"attr,description"`
Url string `jsonapi:"attr,url"`
}

type CollectionItemEntity struct {
ID string `jsonapi:"primary,item"`
Key string `jsonapi:"attr,key"`
Expand Down
Loading

0 comments on commit 7a8839c

Please sign in to comment.