-
Notifications
You must be signed in to change notification settings - Fork 49
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
Guidance on Post-Deployment tests which require identification in a resource-based policy #17
Comments
In fact, I realize now that resource-based policy consideration is unnecessary - even granting IAM permissions to the step's Role with Footnotes
|
These additional IAM permissions should be accomplished through the rolePolicyStatements property in the |
That's a good answer to my follow-on comment, but doesn't address situations where strict resource-based policies are required. If we just grant Identity-based permissions to the If you'll forgive some loose pseudo-code, here's a sketch of the "_Create the role in the context of the pipeline, and pass into the service stack and the testing step _" approach, which is currently my preferred approach:
and an even-more-abbreviated pseudocode representation of how "Create the role in the context of the stage and pass out to the testing step" would look:
It's possible that the answer might simply be "there's no preferred method, do whichever makes most sense in the context of your application", and indeed I do recognize that these two approaches are extremely similar. Just wondering if AWS' significantly more-advanced practice in this area has highlighted any advantages or pitfalls of either. |
I'm looking at this issue again - this time, because we're implementing per-developer personal stacks, which imitate the stacks deployed in Pipeline Stages, but are deployed (based on local versions of code) from terminal commands rather than from a Pipeline. This means that, if testingRoles are created in the context of a pipeline, then these personal stacks' testingRoles1 will need to be passed a reference to the pipeline environment itself. Maybe this is an argument in favour of "Create the role in the context of the stage and pass out to the testing step"? I'm curious if there's been any more thought on this problem from your side. Footnotes
|
Hey @scubbo - I'm not a fan of introducing testing resources within the application stack. That puts me opposed to "Create the role in the context of the stage and pass out to the testing step". I'd suggest a third option - a separate CDK stack that includes the testing resources (both the roles and the policies on the role allowing access to the function). This separate stack would take the lambda ARN as a parameter on the constructor. This allows the pipeline to deploy the stack but also allows developers to deploy those as personal stacks. |
Interesting ok, thanks - I'll tinker with that and get back to you! I'm assuming this means that there would be a Stack within the Stage, as a sibling to the Application Stacks, rather than a single TestingRole(s?)Stack deployed as an earlier Stage of the pipeline - that is, we're creating the Role in the context of the Stage, but not in the context of the ApplicationStack? Otherwise (if there was a single TestingRolesStack as a standalone stage of the pipeline), the cross-Stage (and cross-Environment) dependencies sound like they would be tricky to resolve! |
Hmm, no, my assumption was incorrect - an attempt to create a Testing Role within a Stage, and then use that Testing Role in a CodeBuildStep in the pipeline, results in Definitely looking forward to seeing the model solution updated with this - I've got a working and reasonably-satisfactory setup now, but I'm sure y'all can provide something a lot tidier! :) |
Is your feature request related to a problem? Please describe.
The current reference implementation adds post-deployment testing by calling
addPost
and passing a SoapUITest or JMeterTest, both of which extendCodeBuildStep
and are defined without ascope
or environment. This works well for test executions which only rely on calling an external Internet-available endpoint (which is passed into these TestStacks as aCfnOutput
).However, for test cases which require interacting with created resources directly (perhaps to assert on conditions that should not be visible via the public API), or even if the apiUrl was instead an ApiGatewayLambda (which enforces IAM authentication), we have a problem:
codeBuildStep?.role?.roleArn
orcodeBuildStep?.role?.roleName
for a CodeBuild step without an explicitly passed Role, the value isundefined
)new Role(...)
requires ascope
- which is not available in the current setup of creating a CodeBuild step.Describe the solution you'd like
An expansion of the reference pipeline to demonstrate how to execute tests that require granting resource-based permissions to the Role that will execute the tests (or, a standalone example of how to do so)
Describe alternatives you've considered
AssumeRole
privileges, and create specific Roles for it to assume in order to carry out testingAdditional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: