Sha256: 1825b752008c80c9a794036a0e3e0ce35033bf72e42db45ded35b9ed18ff8658

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

---
title: AWS Secrets
nav_text: Secrets Data
categories: helpers-aws
---

The `aws_secret_data` helper fetches secret data that is one single file from AWS Secrets.

## Example

For example if you have these secret values stored as one file with multiple values separated by `=`.

    $ aws secretsmanager get-secret-value --secret-id demo-dev-secret-data | jq '.SecretString'
    KEY1=secretvalue1
    KEY2=secretvalue2

Kubes can fetch the secret data and base64 encode the values properly.  Example:

.kubes/resources/shared/secret.yaml

```yaml
apiVersion: v1
kind: Secret
metadata:
  name: demo
  labels:
    app: demo
data:
<%= aws_secret_data("demo-dev-secret-data") %>
```

Notice how the text is idented properly by 2 spaces and the values are automatically base64 encoded.

.kubes/output/shared/secret.yaml

```yaml
metadata:
  namespace: demo
  name: demo-2a78a13682
  labels:
    app: demo
apiVersion: v1
kind: Secret
data:
  KEY1: c2VjcmV0dmFsdWUx
  KEY2: c2VjcmV0dmFsdWUy
```

## Options

Here's an example of the available options for `aws_secret_data`.

```ruby
aws_secret_data("demo-#{Kubes.env}-secret-data", base64: true, ident: 2)
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
kubes-0.8.4 docs/_docs/helpers/aws/secret_data.md
kubes-0.8.3 docs/_docs/helpers/aws/secret_data.md