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

feat(ssm): support cross-account sharing #30646

Merged
merged 15 commits into from
Aug 19, 2024

Conversation

pahud
Copy link
Contributor

@pahud pahud commented Jun 24, 2024

AWS introduced SSM Parameter Store cross-account sharing in Feb 2024. Under the hood, the sharing account has to create an AWS RAM ResourceShare for the principal of the consuming account and the consuming account has to accept the sharing invite. The only approach to access that sharing parameter is through CfnParameter. Dynamic Reference is NOT supported.

This PR adds StringParameter.fromStringParameterArn() method so we can use the API like

const remoteParameterArn = 'arn:aws:ssm:us-east-1:123456789012:parameter/dummyName';

const sharedParam = StringParameter.fromStringParameterArn(scope, id, remoteParameterArn);

new cdk.CfnOutput(this, 'ParamValue', { value: sharedParam.stringValue });

Note:

  1. The only option to consume sharing parameters in CFN is template parameter. StringParameter.fromStringParameterArn() would synthesize CfnParameter like:
SharedParameter:
    Description: a shared golden AMI from centralised accounts
    Type: "AWS::SSM::Parameter::Value<String>"
    Default: "arn:aws:ssm:us-east-1:123456789012:parameter/sharedParameterName"

And the Default value has to be a static string. It can't be an unresolved token.

  1. For full use case(sharing, accepting and consuming), check out integ.parameter-store-string-sharing.ts for more details.

Issue # (if applicable)

Closes #29292

Reason for this change

Description of changes

Description of how you validated changes

Debugger

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "node",
      "request": "launch",
      "name": "Jest",
      "program": "${workspaceFolder}/node_modules/jest/bin/jest.js",
      "cwd": "${workspaceFolder}/packages/aws-cdk-lib",
      "args": [
        "--verbose",
        "-i",
        "--no-cache",
        "test/parameter.test.ts",
      ],
      "console": "integratedTerminal",
      "internalConsoleOptions": "neverOpen",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "outFiles": [
        "${workspaceFolder}/**/*.(m|c|)js",
        "!**/node_modules/**"
      ],
    }
  ]
}

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@aws-cdk-automation aws-cdk-automation requested a review from a team June 24, 2024 16:27
@github-actions github-actions bot added effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Jun 24, 2024
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Jun 24, 2024
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@aws-cdk-automation aws-cdk-automation dismissed their stale review July 3, 2024 18:20

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@pahud pahud marked this pull request as ready for review July 3, 2024 19:57
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Jul 3, 2024
@shikha372
Copy link
Contributor

shikha372 commented Aug 12, 2024

Thanks @pahud for submitting the PR, left minor comment, also curious whether we are looking for any further implementation in future probably with help of custom resources etc. to achieve resource sharing feature.

@pahud pahud requested a review from shikha372 August 13, 2024 16:59
Copy link
Contributor

mergify bot commented Aug 19, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Aug 19, 2024
Copy link
Contributor

mergify bot commented Aug 19, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 5c3359c
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Copy link
Contributor

mergify bot commented Aug 19, 2024

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 1eb1ea6 into aws:main Aug 19, 2024
9 checks passed
Copy link

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contribution/core This is a PR that came from AWS. effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

aws_ssm: StringListParameter.ValueForTypedListParameter to support shared parameters
3 participants