feat(codepipeline): cross-environment (account+region) actions#3694
Conversation
Pull Request Checklist
|
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
1 similar comment
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
Pull Request Checklist
|
c5ac2d8 to
65b7cd3
Compare
|
Updated the |
| new kms.Alias(this, 'ArtifactsBucketEncryptionKeyAlias', { | ||
| aliasName: this.generateNameForDefaultBucketKeyAlias(), | ||
| targetKey: encryptionKey, | ||
| removalPolicy: RemovalPolicy.RETAIN, // alias should be retained, like the key |
There was a problem hiding this comment.
Does that not mean that destroying and redeploying the stack will fail?
There was a problem hiding this comment.
Yes, but that was always true, even before adding the Alias (because of the orphaned, physically-named S3 Bucket backing the Pipeline).
There was a problem hiding this comment.
Pinging about this.
65b7cd3 to
2556de0
Compare
|
Added retention policy Retain to the scaffold Alias. |
|
Codebuild (Continuous Integration) build failed for current commits. Please check log and resolve before PR is merged. |
Pull Request Checklist
|
Pull Request Checklist
|
eladb
left a comment
There was a problem hiding this comment.
Why is the title talks about "simultaneous". You basically mean "support cross account and region actions"?
| const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { | ||
| // like was said above - replication buckets need a set physical name | ||
| bucketName: PhysicalName.GENERATE_IF_NEEDED, | ||
| encryptionKey: key, // does not work! |
There was a problem hiding this comment.
You'll get a "Can only reference cross stacks in the same region and account." error.
There was a problem hiding this comment.
Please follow up with @jerry-aws in a separate PR and revisit this doc. I think he will be able to help.
|
|
||
| #### Creating an encrypted replication bucket | ||
|
|
||
| If you're passing a replication bucket created in a different stack, |
There was a problem hiding this comment.
This documentation is weird. Should mostly describe how to do things and not what doesn't work...
There was a problem hiding this comment.
I just wanted to point out a potential "gotcha!" that might trip people up.
If you have a suggestion how to re-structure this documentation, I'm all ears.
eladb
left a comment
There was a problem hiding this comment.
I need a walk through this code. I am really struggling to understand what's going on here (it's me!).
Any chance you can schedule some time next week?
| // This is a problem if the stack the grantee is part of depends on the key stack | ||
| // (as it won't exist before the key policy is attempted to be created). | ||
| // In that case, make the account the resource policy principal | ||
| const granteeStackDependsOnKeyStack = this.granteeStackDependsOnKeyStack(grantee); |
There was a problem hiding this comment.
Do we have some doc reference (or appsec consultation) that this is the best practice?
There was a problem hiding this comment.
What would you suggest as an alternative here, given the comment?
| actions: options.actions, | ||
| resources: (options.resourceSelfArns || options.resourceArns), | ||
| principals: [options.grantee!.grantPrincipal] | ||
| principals: [options.resourcePolicyPrincipal || options.grantee!.grantPrincipal] |
There was a problem hiding this comment.
We don't have separate tests in the IAM library for methods like addToPrincipalAndResource - they're exercised only through tests in the particular Construct Libraries that use them. I'd rather not add them as part of this change. With the KMS test added above, this is now covered as well.
"Simultaneous" means "at the same time", because this PR deals specifically with actions that are both cross-region and cross-account at the same time. "Simultaneous" is just shorter. |
2556de0 to
e71e78c
Compare
Pull request has been modified.
|
Updated with feedback from comments & rebased. |
| const replicationBucket = new s3.Bucket(replicationStack, 'ReplicationBucket', { | ||
| // like was said above - replication buckets need a set physical name | ||
| bucketName: PhysicalName.GENERATE_IF_NEEDED, | ||
| encryptionKey: key, // does not work! |
There was a problem hiding this comment.
Please follow up with @jerry-aws in a separate PR and revisit this doc. I think he will be able to help.
|
Continuous integration build failed |
73df832 to
898cd8e
Compare
|
Fixed the |
Done: #4031 |
This changes the scaffolding stack logic for the cross-region CodePipelines to include a KMS key and alias as part of it, which are required if an action is simultaneously cross-region and cross-account. We also change to use the KMS key ID instead of the key ARN when rendering the ArtifactStores property.
We also add an alias to the default pipeline artifact bucket.
This required a bunch of changes to the KMS and S3 modules:
Fixes #52
Concerns #1584
Fixes #2517
Fixes #2569
Concerns #3275
Fixes #3138
Fixes #3388
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license