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

Add secret manager replication support #827

Conversation

emillbrandt-ngt
Copy link
Contributor

Signed-off-by: Eric Millbrandt [email protected]

SUMMARY

Add support for regional secret replication. The component now supports:

  • Creating a secret with a regional replica
  • Adding a region replica to a secret
  • Removing a region replica from a secret
ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

aws_secret

ADDITIONAL INFORMATION

https://aws.amazon.com/about-aws/whats-new/2021/03/aws-secrets-manager-provides-support-to-replicate-secrets-in-aws-secrets-manager-to-multiple-aws-regions/
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html

Copy link
Member

@markuman markuman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, boto3 says:

Converts an existing secret to a multi-Region secret and begins replication the secret to a list of new regions.

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html#SecretsManager.Client.replicate_secret_to_regions

I think the kms key id must be exists in the region where it is replicated. So the origin kms key id from the source region will not work.

Furthermore, according to the boto3 doc, you can replicate a secret to more than one region.

I think a better parameter pattern will be

- name: some secret
    aws_secret:
      name: "{{ secret_name }}"
      state: present
      secret_type: 'string'
      region: eu-central-1
      kms_key_id: some_key_in_eu_central_1
      secret: "{{ super_secret_string }}"
      replica:
        - region: us-west-1
          kms_key_id: some_key_in_us_west_1
        - region: eu-north-1
          kms_key_id: some_key_in_eu_north_1
    register: result

@emillbrandt-ngt
Copy link
Contributor Author

I like your suggestion. I will refactor to use the pattern you described.

@markuman markuman added the backport-3 PR should be backported to the stable-3 branch label Feb 3, 2022
@markuman
Copy link
Member

markuman commented Feb 3, 2022

I've added the backport-3 label as long as 4.0.0 is not released

@ansibullbot
Copy link

@ansibullbot ansibullbot added feature This issue/PR relates to a feature request integration tests/integration module module needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) tests tests labels Feb 3, 2022
@tremble tremble removed the backport-3 PR should be backported to the stable-3 branch label Jun 29, 2022
@tremble
Copy link
Contributor

tremble commented Jan 31, 2023

To try and get this moving again I've rebased and tweaked the tests.

Because CI only supports us-east-1 at this time I've commented out the CI tests. However, I have tested these locally.

@github-actions
Copy link

github-actions bot commented Jan 31, 2023

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

@ansibullbot ansibullbot added community_review and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jan 31, 2023
@markuman markuman added the backport-5 PR should be backported to the stable-5 branch label Jan 31, 2023
@tremble
Copy link
Contributor

tremble commented Jan 31, 2023

@emillbrandt-ngt Many thanks for taking the time to submit this PR, I'm sorry it's taken so long to get this merged.

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Jan 31, 2023
@emillbrandt-ngt
Copy link
Contributor Author

No worries. Thanks for taking it!

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 03s
✔️ build-ansible-collection SUCCESS in 6m 02s
✔️ ansible-test-sanity-docker-devel SUCCESS in 11m 42s (non-voting)
✔️ ansible-test-sanity-docker-milestone SUCCESS in 10m 23s (non-voting)
✔️ ansible-test-sanity-docker-stable-2.12 SUCCESS in 10m 31s
✔️ ansible-test-sanity-docker-stable-2.13 SUCCESS in 10m 39s
✔️ ansible-test-sanity-docker-stable-2.14 SUCCESS in 10m 35s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 6m 36s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 8m 32s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 6m 37s
✔️ ansible-test-units-amazon-aws-python310 SUCCESS in 8m 01s
✔️ ansible-test-changelog SUCCESS in 2m 22s
✔️ ansible-test-splitter SUCCESS in 2m 34s
✔️ integration-community.aws-1 SUCCESS in 5m 27s
⚠️ integration-community.aws-2 SKIPPED
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit c7c6800 into ansible-collections:main Jan 31, 2023
@patchback
Copy link

patchback bot commented Jan 31, 2023

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/c7c68009080e4e28828ed435db02cdad83712ac6/pr-827

Backported as #1685

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jan 31, 2023
Add secret manager replication support

Signed-off-by: Eric Millbrandt [email protected]
SUMMARY
Add support for regional secret replication.  The component now supports:

Creating a secret with a regional replica
Adding a region replica to a secret
Removing a region replica from a secret

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
aws_secret
ADDITIONAL INFORMATION
https://aws.amazon.com/about-aws/whats-new/2021/03/aws-secrets-manager-provides-support-to-replicate-secrets-in-aws-secrets-manager-to-multiple-aws-regions/
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html

Reviewed-by: Eric Millbrandt <[email protected]>
Reviewed-by: Markus Bergholz <[email protected]>
Reviewed-by: Mark Chappell <None>
Reviewed-by: Alina Buzachis <None>
Reviewed-by: Mark Woolley <[email protected]>
(cherry picked from commit c7c6800)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Jan 31, 2023
[PR #827/c7c68009 backport][stable-5] Add secret manager replication support

This is a backport of PR #827 as merged into main (c7c6800).
Signed-off-by: Eric Millbrandt [email protected]
SUMMARY
Add support for regional secret replication.  The component now supports:

Creating a secret with a regional replica
Adding a region replica to a secret
Removing a region replica from a secret

ISSUE TYPE

Feature Pull Request

COMPONENT NAME
aws_secret
ADDITIONAL INFORMATION
https://aws.amazon.com/about-aws/whats-new/2021/03/aws-secrets-manager-provides-support-to-replicate-secrets-in-aws-secrets-manager-to-multiple-aws-regions/
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/secretsmanager.html

Reviewed-by: Mark Chappell <None>
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
elb_classic_lb - Remove deprecated ec2_elb fact

SUMMARY
Remove previously deprecated ec2_elb fact from elb_classic_lb this only every returned the value 'info'.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
elb_classic_lb
ADDITIONAL INFORMATION
See also ansible-collections#552 and ansible-collections#377 for some of the history.

Reviewed-by: Alina Buzachis <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-5 PR should be backported to the stable-5 branch community_review feature This issue/PR relates to a feature request has_issue integration tests/integration mergeit Merge the PR (SoftwareFactory) module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants