Skip to content

Commit

Permalink
chore: add secret name output and update deps (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetOps authored Jan 28, 2022
1 parent 8c7ad4d commit 213c897
Show file tree
Hide file tree
Showing 7 changed files with 79 additions and 33 deletions.
48 changes: 23 additions & 25 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
on:
pull_request:

# blocked by https://github.com/terraform-docs/gh-actions/pull/46
# name: Generate terraform docs
# on:
# pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}

# jobs:
# docs:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# with:
# ref: ${{ github.event.pull_request.head.ref }}

# - name: Render terraform docs inside the examples/basic/README.md
# uses: terraform-docs/[email protected]
# with:
# working-dir: ./examples/basic/
# git-push: "false"
# config-file: ".terraform-docs.yml"

# - name: Render terraform docs inside the README.md
# uses: terraform-docs/[email protected]
# with:
# working-dir: .
# git-push: "true"
# config-file: ".terraform-docs.yml"
- name: Render terraform docs inside the examples/basic/README.md
uses: terraform-docs/[email protected]
with:
working-dir: ./examples/basic/
git-push: "false"
output-file: README.md
config-file: ".terraform-docs.yml"

- name: Render terraform docs inside the README.md
uses: terraform-docs/[email protected]
with:
working-dir: .
git-push: "true"
output-file: README.md
config-file: ".terraform-docs.yml"
4 changes: 2 additions & 2 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ output:
```hcl
module "label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"
name = "alpha"
namespace = "so"
Expand Down Expand Up @@ -69,4 +69,4 @@ settings:
lockfile: true
required: true
sensitive: true
type: true
type: true
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Terraform module to provision and manage AWS Secrets Manager.
```hcl
module "label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"
name = "alpha"
namespace = "so"
Expand All @@ -28,7 +28,6 @@ module "secrets" {
version = "0.1.0"
secret_version = {
enabled = true
secret_string = jsonencode(
{
ssh_public_key = base64encode(module.ssh_key_pair.public_key)
Expand Down Expand Up @@ -110,6 +109,7 @@ module "secrets" {
| <a name="output_id"></a> [id](#output\_id) | ID of the secret |
| <a name="output_key_arn"></a> [key\_arn](#output\_key\_arn) | KMS key ARN |
| <a name="output_kms_key_id"></a> [kms\_key\_id](#output\_kms\_key\_id) | KMS key ID |
| <a name="output_name"></a> [name](#output\_name) | Name of the secret |
| <a name="output_version_id"></a> [version\_id](#output\_version\_id) | The unique identifier of the version of the secret. |
<!-- END_TF_DOCS -->

Expand Down
46 changes: 44 additions & 2 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
## terraform-aws-secretsmanager
Terraform module to provision and manage AWS Secrets Manager.

## Usage

```hcl
module "label" {
source = "cloudposse/label/null"
version = "0.25.0"
name = "alpha"
namespace = "so"
stage = "staging"
}
module "ssh_key_pair" {
source = "cloudposse/key-pair/aws"
version = "0.18.1"
ssh_public_key_path = "keys/"
generate_ssh_key = "true"
context = module.label.context
}
module "secrets" {
source = "SweetOps/secretsmanager/aws"
version = "0.1.0"
secret_version = {
secret_string = jsonencode(
{
ssh_public_key = base64encode(module.ssh_key_pair.public_key)
ssh_private_key = base64encode(module.ssh_key_pair.private_key)
}
)
}
context = module.label.context
}
```

<!-- BEGIN_TF_DOCS -->
## Requirements

Expand All @@ -14,8 +56,8 @@ No providers.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_label"></a> [label](#module\_label) | cloudposse/label/null | 0.24.1 |
| <a name="module_secrets"></a> [secrets](#module\_secrets) | SweetOps/secretsmanager/aws | 0.1.0 |
| <a name="module_label"></a> [label](#module\_label) | cloudposse/label/null | 0.25.0 |
| <a name="module_secrets"></a> [secrets](#module\_secrets) | SweetOps/secretsmanager/aws | ../../ |
| <a name="module_ssh_key_pair"></a> [ssh\_key\_pair](#module\_ssh\_key\_pair) | cloudposse/key-pair/aws | 0.18.1 |

## Resources
Expand Down
4 changes: 2 additions & 2 deletions examples/basic/main.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module "label" {
source = "cloudposse/label/null"
version = "0.24.1"
version = "0.25.0"

name = "alpha"
namespace = "so"
Expand All @@ -19,7 +19,7 @@ module "ssh_key_pair" {

module "secrets" {
source = "SweetOps/secretsmanager/aws"
version = "0.1.0"
version = "../../"

secret_version = {
enabled = true
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
locals {
enabled = module.this.enabled
secret_name = one(aws_secretsmanager_secret.default[*].name)
secret_id = one(aws_secretsmanager_secret.default[*].id)
secret_arn = one(aws_secretsmanager_secret.default[*].arn)
version_id = one(aws_secretsmanager_secret_version.default[*].version_id)
Expand Down
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
output "name" {
value = local.secret_name
description = "Name of the secret"
}

output "id" {
value = local.secret_id
description = "ID of the secret"
Expand Down

0 comments on commit 213c897

Please sign in to comment.