diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index b5e64b4..58dd5ab 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -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/gh-actions@v0.10.0 -# with: -# working-dir: ./examples/basic/ -# git-push: "false" -# config-file: ".terraform-docs.yml" - -# - name: Render terraform docs inside the README.md -# uses: terraform-docs/gh-actions@v0.10.0 -# with: -# working-dir: . -# git-push: "true" -# config-file: ".terraform-docs.yml" + - name: Render terraform docs inside the examples/basic/README.md + uses: terraform-docs/gh-actions@v0.11.0 + 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/gh-actions@v0.11.0 + with: + working-dir: . + git-push: "true" + output-file: README.md + config-file: ".terraform-docs.yml" diff --git a/.terraform-docs.yml b/.terraform-docs.yml index f161d11..846f368 100644 --- a/.terraform-docs.yml +++ b/.terraform-docs.yml @@ -12,7 +12,7 @@ output: ```hcl module "label" { source = "cloudposse/label/null" - version = "0.24.1" + version = "0.25.0" name = "alpha" namespace = "so" @@ -69,4 +69,4 @@ settings: lockfile: true required: true sensitive: true - type: true \ No newline at end of file + type: true diff --git a/README.md b/README.md index ba5005d..7eb1a38 100644 --- a/README.md +++ b/README.md @@ -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" @@ -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) @@ -110,6 +109,7 @@ module "secrets" { | [id](#output\_id) | ID of the secret | | [key\_arn](#output\_key\_arn) | KMS key ARN | | [kms\_key\_id](#output\_kms\_key\_id) | KMS key ID | +| [name](#output\_name) | Name of the secret | | [version\_id](#output\_version\_id) | The unique identifier of the version of the secret. | diff --git a/examples/basic/README.md b/examples/basic/README.md index 569e3f1..c6b559b 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -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 +} +``` + ## Requirements @@ -14,8 +56,8 @@ No providers. | Name | Source | Version | |------|--------|---------| -| [label](#module\_label) | cloudposse/label/null | 0.24.1 | -| [secrets](#module\_secrets) | SweetOps/secretsmanager/aws | 0.1.0 | +| [label](#module\_label) | cloudposse/label/null | 0.25.0 | +| [secrets](#module\_secrets) | SweetOps/secretsmanager/aws | ../../ | | [ssh\_key\_pair](#module\_ssh\_key\_pair) | cloudposse/key-pair/aws | 0.18.1 | ## Resources diff --git a/examples/basic/main.tf b/examples/basic/main.tf index ad821ea..560a4fb 100644 --- a/examples/basic/main.tf +++ b/examples/basic/main.tf @@ -1,6 +1,6 @@ module "label" { source = "cloudposse/label/null" - version = "0.24.1" + version = "0.25.0" name = "alpha" namespace = "so" @@ -19,7 +19,7 @@ module "ssh_key_pair" { module "secrets" { source = "SweetOps/secretsmanager/aws" - version = "0.1.0" + version = "../../" secret_version = { enabled = true diff --git a/main.tf b/main.tf index f0560ea..238ecde 100644 --- a/main.tf +++ b/main.tf @@ -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) diff --git a/outputs.tf b/outputs.tf index ff6c7d0..8d69f66 100644 --- a/outputs.tf +++ b/outputs.tf @@ -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"