feat(aws): add configurable tagging API resource resolver#913
Open
tom-groves wants to merge 3 commits intonitrictech:mainfrom
Open
feat(aws): add configurable tagging API resource resolver#913tom-groves wants to merge 3 commits intonitrictech:mainfrom
tom-groves wants to merge 3 commits intonitrictech:mainfrom
Conversation
…onfig Add `resource-resolver: tagging` stack config option that skips SSM parameter creation and tells the runtime to use the Resource Groups Tagging API for resource discovery. This avoids the SSM 4KB/8KB size limit that breaks large stacks. Default behaviour (SSM) is unchanged.
Add resource-resolver option to both Pulumi and Terraform AWS provider stack configuration reference. Explains the 'ssm' (default) vs 'tagging' modes and the SSM size limit motivation.
Address code review feedback: - Validate resource-resolver accepts only "ssm" or "tagging", rejecting typos with a clear error at deploy time - Extract ResourceResolverSSM and ResourceResolverTagging constants to eliminate magic string duplication across 7 call sites - Add unit tests for config validation (default, explicit ssm, tagging, and invalid values)
|
@tom-groves is attempting to deploy a commit to the Nitric Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add a
resource-resolver: taggingstack config option that allows the AWS provider to skip SSM Parameter Store for runtime resource discovery and use the AWS Resource Groups Tagging API instead.Problem: The AWS provider stores a JSON resource index in SSM Parameter Store so Lambda functions can discover peer resources (buckets, topics, secrets, etc.) at runtime. SSM Standard tier has a 4,096-character limit. A prior fix auto-selects Advanced tier (8KB limit), but this is still a ceiling that gets hit with larger stacks (e.g. 22 topics, 14 secrets, 7 buckets, 6 KV stores produces ~9KB of JSON).
Solution: The runtime already has a fully working
AwsTaggedResourceResolverusing the Resource Groups Tagging API, selectable viaNITRIC_AWS_RESOURCE_RESOLVER=taggingenv var. Resources are already tagged at deploy time withx-nitric-<stackId>-nameandx-nitric-<stackId>-typetags. Thetag:GetResourcesandapigateway:GETIAM permissions are already granted unconditionally to Lambda and Batch roles. This PR simply wires up a config option to skip SSM creation and pass the env var through.GCP and Azure don't have this problem — they use tag/label-based resolution by default with no stored index. This change aligns the AWS provider with that pattern (opt-in for now).
Stack file usage:
Type of change
Changes by file
cloud/aws/common/config.goResourceResolverfield,ResourceResolverSSM/ResourceResolverTaggingconstants, default to"ssm", validate against known valuescloud/aws/common/config_test.gocloud/aws/deploy/resources.go"tagging"— skip SSM parameter creationcloud/aws/deploy/service.goNITRIC_AWS_RESOURCE_RESOLVERenv var on Lambda when"tagging"cloud/aws/deploy/batch.goNITRIC_AWS_RESOURCE_RESOLVERenv var on Batch jobs when"tagging"cloud/aws/deploytf/resources.go"tagging"— skip SSM parameter creationcloud/aws/deploytf/service.goNITRIC_AWS_RESOURCE_RESOLVERenv var on CDKTF services when"tagging"docs/docs/providers/pulumi/aws.mdxresource-resolveroption in stack config referencedocs/docs/providers/terraform/aws.mdxresource-resolveroption in stack config referenceWhat is NOT changed
tag:GetResourcesandapigateway:GETalready granted unconditionallyTesting
Unit tests
Existing runtime resource resolver tests also pass unchanged.
Live deployment — Pulumi Provider (
nitric/aws@0.0.1)Built both provider binaries from this branch and deployed a test project with a bucket, topic, secret, and API to
us-east-2withresource-resolver: tagging. 7/7 verification tests passed:ParameterNotFoundconfirmedNITRIC_AWS_RESOURCE_RESOLVER=taggingtagging-test_services-api-5b01437{"status":"ok","resolver":"tagging"}Generated Terraform inspection — CDKTF Provider (
nitric/awstf@0.0.1)parametermodule in generated Terraformapi,bucket,policy×3,secret,service,stack,topic— noparameterNITRIC_AWS_RESOURCE_RESOLVER=taggingin service envcdk.tf.jsonservice module