feat(ingestor-api): user provided role ARN#38
Conversation
* rename dataAccessRole to dataAccessRoleArn and it is now a string * remove the call to grantAssumeRole on the data access role * take the stac ingestor API handler role ARN from user input BREAKING CHANGE: requiring the stacIngestorRoleArn and dataAccessRoleArn and removing dataAccessRole
17b1a7b to
0b6b7f0
Compare
|
@emileten I think we can apply a slightly cleaner solution for this. To summarize, when using the To remedy this we need to expose the I'd recommend closing this PR in favor of a new one which
ref https://github.com/developmentseed/aws-asdi-pgstac/issues/20 |
|
Thanks @sharkinsspatial. I understand the idea of forcing the dependency through the usage of a property. I see that we are trying to force the CDK to first create the data access role without the trust relationship added, then create the stac ingestor, and then only add the trust relationship. Just wanted to make sure your suggestion works (not only deploys, which I guess you tested, but also, lambda tests actually runs, which you probably haven't tested because it's using one of my account buckets), and I just confirmed 👍 Remaining question -- why do you think this is cleaner? Because it's a smaller change? Or because you think it's better to have the handler role created where its lambda is created -- in the latter case I am curious what the reasons are ? |
|
@emileten I didn’t test the bucket access but I did test to confirm that the call to assume_role was working (which is the main concern). I’d prefer this approach as our Lambda role is self contained within the construct. If we need to modify it in the future with additional permissions we can do so without issues. Creating this role outside of the construct would not allow us to modify its permissions. |
|
Thanks @sharkinsspatial. Closing this and will reopen a new one. |
Breaking change : we're now expecting the stac ingestor handler role to exist and need its ARN, and we change the
dataAccessRoleparameter todataAccessRoleArn. This allows me to solve what I poorly described here., which essentially means both the aws-asdi and maap sides that use cdk-pgstac are broken as is, because there is a two-way dependency between the data access role and the stac ingestor api handler role.I tried several solutions that didn't involve changing things here but instead in the user sides (aws-asdi, maap). None were working, so I resorted to this, and I actually think it makes much more sense to handle the role creation and cross role dependencies as a separate component.
stacIngestorRoleArnstringproperty to theStacIngestorclass. Whereas before, we were creating this role as part of theStacIngestorconstruct, now we are assuming this role already exists (with the right policies), and import it using the user provided role ARN, which this new property represents.dataAccessRoleproperty name todataAccessRoleArn, and it's now not anymore aiam.Roleobject but astringrepresenting the ARN of that role, which is only used when passed to the lambda that will assume that role when verifying data on S3. Removed the line where we call itsgrantAssumeRolemethod : it doesn't do anything.The MAAP deployment relies on this. Here is how this gets used.