-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduces a new logdna_key resource to interact with the keys api to manage service and ingestion keys. This change includes some additional upkeep changes: * Update github.com/hashicorp/terraform-plugin-sdk/v2 to v2.15.0 * Remove duplicate code around existence testing * Have requests use the http client attached to the provider instead of creating a new one each time * Ensure all tests respect the env API_URL * Fix memory reference error when testing existence of non-existent resource Ref: LOG-12483 Signed-off-by: Jacob Hull [email protected]
- Loading branch information
1 parent
44e0f20
commit 51a328a
Showing
17 changed files
with
428 additions
and
214 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Resource: `logdna_key` | ||
|
||
This resource allows you to manage ingestion and service keys. | ||
|
||
## Example | ||
|
||
```hcl | ||
provider "logdna" { | ||
servicekey = "xxxxxxxxxxxxxxxxxxxxxxxx" | ||
} | ||
resource "logdna_key" "service-key" { | ||
type = "service" | ||
lifecycle { | ||
create_before_destroy = true | ||
} | ||
} | ||
resource "logdna_key" "ingestion-key" { | ||
type = "ingestion" | ||
lifecycle { | ||
create_before_destroy = true | ||
} | ||
} | ||
``` | ||
|
||
The `create_before_destroy` and `lifecycle` meta-argument are not required, but ensure a valid key is always available so there's no disruption of service. | ||
|
||
## Key Rotation | ||
|
||
This resource can be used in conjuction with automated scripts to perform automatic key rotations, e.g., | ||
|
||
```sh | ||
# Run this every time you want to rotate the key | ||
$ terraform apply -replace="logdna_key.my_key" | ||
``` | ||
|
||
## Argument Reference | ||
|
||
The following arguments are supported: | ||
|
||
- `type`: **string** _(Required)_ The type of key to be used. Should be either `service` or `ingestion`. | ||
|
||
## Attributes Reference | ||
|
||
In addition to all the arguments above, the following attributes are exported: | ||
|
||
- `id`: **string** The unique identifier of this key. | ||
- `key`: **string** The actual key value. | ||
- `type`: **string** The type of key. | ||
- `created`: **int** The date the key was created in Unix time milliseconds. | ||
|
||
## Import | ||
|
||
A key can be imported using the `id`, e.g., | ||
|
||
```sh | ||
$ terraform import logdna_key.my_key <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
Oops, something went wrong.