Skip to content

Commit

Permalink
Merge pull request #63 from humanitec/WAL-8973-agents
Browse files Browse the repository at this point in the history
feat: add agent resource
  • Loading branch information
delca85 authored Feb 13, 2024
2 parents 3d89214 + 3e59b8d commit 0c104fc
Show file tree
Hide file tree
Showing 7 changed files with 590 additions and 2 deletions.
52 changes: 52 additions & 0 deletions docs/resources/agent.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "humanitec_agent Resource - terraform-provider-humanitec"
subcategory: ""
description: |-
An Agent represents an instance of the Humanitec Agent that will be used by the Platform Orchestrator to deploy into a private cluster.
---

# humanitec_agent (Resource)

An Agent represents an instance of the Humanitec Agent that will be used by the Platform Orchestrator to deploy into a private cluster.

## Example Usage

```terraform
resource "humanitec_agent" "example" {
id = "agent-id"
description = "Demo Agent"
public_keys = [
{
key = "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtVChdg1SCUsMEs9Zuiuj\nRCNF7yGbLc+7GxchgsLrRhvqRjLkNh/757rS5Xb6fn5PSdV34iKsM1t/DNrohD6n\n/qO5CFT9PmJscG92ONNrma9Q+G2VqgOcQTBsvROnOXt3/sz3KxoVg7PH+dvpPOc2\na3vYI094OQ9290BtORer0gjdiacCadXlIucrfwQHHns5FUv8kui+AJ/EMRCGANkL\nW7V8sgrDJsazd9K+kZt6nBR2oalzmkTdS37hP1CqK2UzzZg+W2g6MjHIe6XfYqJa\nRnOSFM6sqRSXcgNH9ClUcCBvoDXtC1UxwIqstaHqXiEYiBntpHc9b7YxEfAs0Y3K\n574vbkN45hnx4q1je2Ajipfi6rCrD5krCZ3m00NtoddgjuTL4a5p9UxmC99WXacu\nxflmkpdYjI4fqvbZYBjc4JWuW95iW213BN2dlqQaEIKhepjROXc4D9AhMTjo4Vlr\nPrl32RuSLc+ZepP3KWxC/1X92PvHsrgQ09X4a1qZY8iBG468G6v2jOeJYTWDcXR+\nbEcw9ziXQtqwnI+PZEzDAJKNYA1VGSGQ1cr27aNUH6HcEb05mwIHXom7fYL1sEye\nWfJuEsiO2vlIh5L8FbyuNjafAPJHtw3TJAcq9JY7RGgM9fhc2NKLKnIKARBsycCS\nF+tcM6Fm/SqGiW7McuKcGsECAwEAAQ==\n-----END PUBLIC KEY-----\n"
}
]
}
```

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

### Required

- `id` (String) The ID of the Agent.
- `public_keys` (Attributes Set) A non-empty list of pcks8 RSA public keys PEM encoded (as the ones produced by openssl), whose module length is greater or equal than 4096 bits. (see [below for nested schema](#nestedatt--public_keys))

### Optional

- `description` (String) A description to show future users. It can be empty.

<a id="nestedatt--public_keys"></a>
### Nested Schema for `public_keys`

Required:

- `key` (String) A pcks8 RSA public keys PEM encoded (as the ones produced by openssl), whose module length is greater or equal than 4096 bits.

## Import

Import is supported using the following syntax:

```shell
terraform import humanitec_agent.example agent_id
```
1 change: 1 addition & 0 deletions examples/resources/humanitec_agent/import.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import humanitec_agent.example agent_id
9 changes: 9 additions & 0 deletions examples/resources/humanitec_agent/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
resource "humanitec_agent" "example" {
id = "agent-id"
description = "Demo Agent"
public_keys = [
{
key = "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAtVChdg1SCUsMEs9Zuiuj\nRCNF7yGbLc+7GxchgsLrRhvqRjLkNh/757rS5Xb6fn5PSdV34iKsM1t/DNrohD6n\n/qO5CFT9PmJscG92ONNrma9Q+G2VqgOcQTBsvROnOXt3/sz3KxoVg7PH+dvpPOc2\na3vYI094OQ9290BtORer0gjdiacCadXlIucrfwQHHns5FUv8kui+AJ/EMRCGANkL\nW7V8sgrDJsazd9K+kZt6nBR2oalzmkTdS37hP1CqK2UzzZg+W2g6MjHIe6XfYqJa\nRnOSFM6sqRSXcgNH9ClUcCBvoDXtC1UxwIqstaHqXiEYiBntpHc9b7YxEfAs0Y3K\n574vbkN45hnx4q1je2Ajipfi6rCrD5krCZ3m00NtoddgjuTL4a5p9UxmC99WXacu\nxflmkpdYjI4fqvbZYBjc4JWuW95iW213BN2dlqQaEIKhepjROXc4D9AhMTjo4Vlr\nPrl32RuSLc+ZepP3KWxC/1X92PvHsrgQ09X4a1qZY8iBG468G6v2jOeJYTWDcXR+\nbEcw9ziXQtqwnI+PZEzDAJKNYA1VGSGQ1cr27aNUH6HcEb05mwIHXom7fYL1sEye\nWfJuEsiO2vlIh5L8FbyuNjafAPJHtw3TJAcq9JY7RGgM9fhc2NKLKnIKARBsycCS\nF+tcM6Fm/SqGiW7McuKcGsECAwEAAQ==\n-----END PUBLIC KEY-----\n"
}
]
}
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbg
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240108055932-686b39d75090 h1:2/rQ2TfT/w2NTJCMiwaWupNPiP8g9TbXZktEmTYckj4=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240108055932-686b39d75090/go.mod h1:pIhrOozOV1z0sQewcCfEdsQjoaCBi7K6TixbKzE2TPI=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240125162713-ab58fb4e601e h1:tBHMUWLtZOTx049PI6DpRJscwKdVw5dPKNkqBMxFulg=
github.com/humanitec/humanitec-go-autogen v0.0.0-20240125162713-ab58fb4e601e/go.mod h1:pIhrOozOV1z0sQewcCfEdsQjoaCBi7K6TixbKzE2TPI=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
Expand Down
1 change: 1 addition & 0 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ func (p *HumanitecProvider) Configure(ctx context.Context, req provider.Configur
func (p *HumanitecProvider) Resources(ctx context.Context) []func() resource.Resource {
return []func() resource.Resource{
NewResourceAccountResource,
NewResourceAgent,
NewResourceApplication,
NewResourceApplicationUser(true),
NewResourceApplicationUser(false),
Expand Down
Loading

0 comments on commit 0c104fc

Please sign in to comment.