fix: grant AWS SQLWorkspace RDS vendor permissions - #153
Conversation
Co-authored-by: Codex <codex@openai.com>
The argo AWS v2 workflow provisions an RDS instance as the RisingWave meta store (sqlworkspace-rds-* resources tagged Vendor=StreamNative). Add scoped RDS create/manage/final-snapshot permissions to the StreamNativeCloudProvisionPreservePolicy and the permission boundary, mirroring the existing least-privilege SQLWorkspace S3 statements.
The upbound terraform provider queries engine versions and instance state while provisioning; broaden the RDS grant from specific Describe actions to rds:Describe* in the bootstrap policy and permission boundary.
The vendor-access S3 scope (s3_bucket_pattern, typically "snc-*") does not match the per-poolmember tiered-storage bucket names produced by terraform-aws-cloud's dns-bucket module (<pm>-tiered-storage-snc). Creating a new poolmember therefore fails at provision1 with s3:CreateBucket AccessDenied, before SQLWorkspace provisioning even starts. - provision_preserve: allow s3:CreateBucket and bucket management on *-tiered-storage-snc alongside the configured bucket pattern - runtime_iam_policy: allow ListBucket and object access on *-tiered-storage-snc alongside the configured bucket pattern
maxsxu
left a comment
There was a problem hiding this comment.
I have two requested changes to keep the IAM model consistent and avoid coupling authorization to SQLWorkspace resource names:
-
In
permission_boundary_iam_policy.json.tpl, please addrds:*toAllowedServicesand remove the detailedSQLWorkspaceRDS*statements. The permission boundary should define the service-level ceiling; the scoped permissions belong in the attached provision policy. The boundary does not grant RDS access by itself—the effective permissions remain the intersection with the role's identity policies. -
In
provision2.json.tpl, please replace the*-sncresource-name restrictions with tag-based authorization:- Use
aws:RequestTag/Vendor = StreamNativeforCreateDBInstance,CreateDBSubnetGroup, and the requiredAddTagsToResourceauthorization during creation. - Preserve the PostgreSQL, private-access, and encrypted-storage conditions on
CreateDBInstance. - Use
aws:ResourceTag/Vendor = StreamNativefor modify, delete, and post-create tag operations. - Keep
Describe*and list operations unscoped where RDS does not support resource-level tag authorization. - Prevent removal of the
Vendorownership tag, since removing it would make the resource unmanageable through the tag-based policy.
- Use
This removes the load-bearing -snc naming convention while retaining ownership scoping. The current consumer uses skip_final_snapshot = true, so I suggest removing CreateDBSnapshot from this policy rather than retaining a name-scoped snapshot rule. If final snapshots are required, that path should be handled and tested separately because the target snapshot does not yet have a resource tag during authorization.
References:
Motivation
SQLWorkspace needs a PostgreSQL meta store per poolmember, but
StreamNativeCloudBootstrapRolehas no RDS write permissions, sords:CreateDBSubnetGroup/rds:CreateDBInstanceare denied by both the attached policy and the permission boundary.Modifications
*-sncresources inprovision2.json.tpl: create instance and subnet group (postgres, private, encrypted,Vendor=StreamNative), manage/delete, tag, and final snapshot.rds:Describe*andrds:ListTagsForResourcein the existing read-only statement.terraform fmt(whitespace only).Notes:
rds:AddTagsToResourceis granted separately and is required for create to succeed.og:default*/pg:default*are needed becauseCreateDBInstanceauthorizes against the default parameter and option groups it attaches.Testing
terraform validateandterraform fmt -checkpass inmodules/aws/vendor-access.