Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a new filter plugin that can encrypt and decrypt values using AWS KMS service #55920

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
2 participants
@achinthagunasekara
Copy link
Contributor

commented Apr 30, 2019

SUMMARY

Adding a new filter plugin that can encrypt and decrypt values using AWS KMS service.
This filter plugin can be used to encrypt values using the AWS KMS service and store them within your repository, then decrypt then when you want to use them.

Example

Decrypting

In my_role\defaults\main.yml

encrypted_value: >-
  {{ abcd123abcd13 abcd123abcd13abcd12abcd13
  abcd123abcd13abcd123abcd13abcd123ab1d1312
  abcd123abcd13abcd123abcd13abcd123ssdsas12
  sadsdsasd | aws_kms_decrypt(KEY_ARN) }}

In my_role\tasks\main.yml

- debug:
    msg: "Decrypted value is {{ encrypted_value }}"

Same can be done for encrypting values.

Encrypting

In my_role\tasks\main.yml

- debug:
    msg: "Encrypted value is {{ 'abc123abc123abc123' | aws_kms_encrypt(KEY_ARN) }}"

Arguments

You can call aws_kms_encrypt and aws_kms_encrypt from this plugin with following variables.

  • Mandatory - ciphertext (str): Encrypted item to decrypt.
  • Mandatory - key_arn (str): AWS ARN to the KMS key.
  • Optional - region (str): AWS region to use.
  • Optional - profile (str): AWS credential profile to use.
  • Optional - role_arn (str): AWS IAM role to use to get credentials.
  • Optional - aws_access_key (str): AWS access key to use.
  • Optional - aws_secret_key (str): AWS secret key to use.

Getting AWS Credentias will use following order.

profile > role_arn > aws_access_key and aws_secret_key > instance IAM profile or default profile

ADDITIONAL INFORMATION

Related to #44014 and #54150

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.