-
Notifications
You must be signed in to change notification settings - Fork 4k
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(s3-deployment): create DeployTimeSubstitutedFile
to allow substitutions in file
#25876
Conversation
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
There was a problem hiding this 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.
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
…{{ brackets }} in the local file Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
…assed in Signed-off-by: Sumu <sumughan@amazon.com>
packages/aws-cdk-lib/aws-s3-deployment/lib/bucket-deployment.ts
Outdated
Show resolved
Hide resolved
.../@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.parametrized-swagger.api.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Otavio Macedo <288203+otaviomacedo@users.noreply.github.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
.../@aws-cdk-testing/framework-integ/test/aws-apigateway/test/integ.parametrized-swagger.api.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Sumu <sumughan@amazon.com>
…d that it does not double substitute variables Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
Signed-off-by: Sumu <sumughan@amazon.com>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
This is great. Could the same be done for an My use-case is that I have a third-party construct that accepts an S3 path for a script to run. |
Does this actually work as-is or does it need other changes? If I actually substitute any parameters I end up getting an "Invalid OAS input" failure error. If I hard-code values with the same code (just no substitutions in the file) it works fine. Any help would be great as this seems like a nice way to actually use my API spec compared to other options I've seen out there. const deployment = new s3deploy.DeployTimeSubstitutedFile(
this,
"MyApiFile",
{
source: path.join(__dirname, "../../openapi-spec/api-definition.yaml"),
destinationBucket: bucket,
destinationKey: "api-definition.yaml",
substitutions: {
LAMBDA_ARN: lambdaFunction.functionArn,
AWS_REGION: this.region,
},
}
);
const api = new apigateway.SpecRestApi(this, "CdkApi", {
apiDefinition: apigateway.ApiDefinition.fromBucket(
deployment.deployedBucket, // also tried with deployment.bucket
deployment.objectKey
),
}); |
Closes #1461
The
DeployTimeSubstitutedFile
construct allows you to upload a file and specify substitutions to be made in it, which will be resolved during deployment.For example, if you wanted to create a REST API from a Swagger file spec but want to reference other CDK resources in your API spec, you can now do so in-line:
Where 'xxxx' and 'yyyy' are the examples of placeholder text you can add in your local file spec to be substituted by surrounding the placeholder with double curly braces, for example writing:
{{ xxxx }}
in your file where you want a substitution.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license