-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement methods for user secrets management
This commit introduces internal/juju/userSecret and adds method to add user secrets. Implement internal Juju secrets add, update, and remove functionality This commit introduces several changes to the Juju client in the `internal/juju/client.go` file. It includes the implementation of methods for adding, updating, and removing secrets. Additionally, Furthermore, the commit includes changes to the `secret.go` file, introducing new types for managinng secrets. It also includes changes to the `interfaces.go` file, defining new interfaces for the Juju client API. Add secretURI to UpdateSecret Add secretURI to DeleteSecret Add AutoPrunt to UpdateSecret schema Add SecretId to ReadSecret func instead of name. Add lost Asserts. Add secretNotFoundError Extract mocks creation into separate suite. Introduce typedError(err) usage in ClientAPI funcs. Add renaming to UpdateSecret Use struct raather than pointer for Output structures. Introcue NewName in Update input struct. Use pointers in all places in structs where the parameter is not neccessary. Implement schema for user secrets management This commit introduces the ability to add, update, and remove user secrets in the schema. This is done through the `userSecretResource` struct, which has methods for each of these actions. The `Add`, `Update`, and `Remove` methods are currently stubbed out and will need to be implemented in future commits. Add ReadSecret function implementation. Implement Delete secret function Add base64 encoding co Create and change Read fucntion to get value with decode. Add base64 encoding for values in Update
- Loading branch information
Showing
22 changed files
with
650 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "juju_secret Resource - terraform-provider-juju" | ||
subcategory: "" | ||
description: |- | ||
A resource that represents a Juju secret. | ||
--- | ||
|
||
# juju_secret (Resource) | ||
|
||
A resource that represents a Juju secret. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "juju_secret" "this" { | ||
model = juju_model.development.name | ||
name = "this_secret_name" | ||
value = { | ||
key1 = "value1" | ||
key2 = "value2" | ||
} | ||
info = "This is the secret" | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `model` (String) The model in which the secret belongs. | ||
- `value` (Map of String, Sensitive) The value map of the secret. There can be more than one key-value pair. | ||
|
||
### Optional | ||
|
||
- `info` (String) The description of the secret. | ||
- `name` (String) The name of the secret. | ||
|
||
### Read-Only | ||
|
||
- `secret_id` (String) The ID of the secret. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# Secrets can be imported by using the URI as in the juju show-secrets output. | ||
# Example: | ||
# $juju show-secret secret-name | ||
# coh2uo2ji6m0ue9a7tj0: | ||
# revision: 1 | ||
# owner: <model> | ||
# name: secret-name | ||
# created: 2024-04-19T08:46:25Z | ||
# updated: 2024-04-19T08:46:25Z | ||
$ terraform import juju_secret.secret-name coh2uo2ji6m0ue9a7tj0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "juju_secret_access Resource - terraform-provider-juju" | ||
subcategory: "" | ||
description: |- | ||
A resource that represents a Juju secret access. | ||
--- | ||
|
||
# juju_secret_access (Resource) | ||
|
||
A resource that represents a Juju secret access. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
resource "juju_secret_access" "this" { | ||
model = juju_model.development.name | ||
applications = [ | ||
juju_application.app.name, juju_application.app2.name | ||
] | ||
secret_id = juju_secret.that.secret_id | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `applications` (List of String) The list of applications to which the secret is granted or revoked. | ||
- `model` (String) The model in which the secret belongs. | ||
- `secret_id` (String) The ID of the secret. | ||
|
||
## Import | ||
|
||
Import is supported using the following syntax: | ||
|
||
```shell | ||
# Secret access can be imported by using the URI as in the juju show-secrets output. | ||
# Example: | ||
# $juju show-secret secret-name | ||
# coh2uo2ji6m0ue9a7tj0: | ||
# revision: 1 | ||
# owner: <model> | ||
# name: secret-name | ||
# created: 2024-04-19T08:46:25Z | ||
# updated: 2024-04-19T08:46:25Z | ||
$ terraform import juju_secret_access.secret-access-name coh2uo2ji6m0ue9a7tj0 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Secrets can be imported by using the URI as in the juju show-secrets output. | ||
# Example: | ||
# $juju show-secret secret-name | ||
# coh2uo2ji6m0ue9a7tj0: | ||
# revision: 1 | ||
# owner: <model> | ||
# name: secret-name | ||
# created: 2024-04-19T08:46:25Z | ||
# updated: 2024-04-19T08:46:25Z | ||
$ terraform import juju_secret.secret-name coh2uo2ji6m0ue9a7tj0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
resource "juju_secret" "this" { | ||
model = juju_model.development.name | ||
name = "this_secret_name" | ||
value = { | ||
key1 = "value1" | ||
key2 = "value2" | ||
} | ||
info = "This is the secret" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Secret access can be imported by using the URI as in the juju show-secrets output. | ||
# Example: | ||
# $juju show-secret secret-name | ||
# coh2uo2ji6m0ue9a7tj0: | ||
# revision: 1 | ||
# owner: <model> | ||
# name: secret-name | ||
# created: 2024-04-19T08:46:25Z | ||
# updated: 2024-04-19T08:46:25Z | ||
$ terraform import juju_secret_access.secret-access-name coh2uo2ji6m0ue9a7tj0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "juju_secret_access" "this" { | ||
model = juju_model.development.name | ||
applications = [ | ||
juju_application.app.name, juju_application.app2.name | ||
] | ||
secret_id = juju_secret.that.secret_id | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.