-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
feat(organizations): add basic organizations higher level constructs #23001
Conversation
> basic higher level constructs **features:** - adds higher level constructs `Account`, `OrganizationalUnit`, `Policy` building up the org tree - adds utility construct `OrganizationRoot` to retrieve the root for the first organizational units (singleton `AwsCustomResource`) **todo:** - [] decide how to sequentially chain the organization tree - [] add doc blocks, usage example and howtos - [] improve tests (unit coverage and integ tests) > sequentially chain resources is an important feature. The AWS Organizations API can create accounts only sequentially. Also adding policies, delegating administration and enabling trusted services needs to sequentially chained. Here is a solution that uses the construct tree walking `Aspect`: [https://github.com/pepperize/cdk-organizations/blob/main/src/dependency-chain.ts](https://github.com/pepperize/cdk-organizations/blob/main/src/dependency-chain.ts). Another option could be to chain the dependencies in the `Account` and `OrganizationalUnit` **inversion of parentship:** It could be useful to inverse the parent child relation, for example ```typescript organizationalUnit.addAccount(account); ``` instead of ``` new Account(scope, id, { parent: ou, }); ``` also it could be useful to inverse the policy attachment ```typescript export class Account { public function attachPolicy(policy: IPolicy): void { policy.addAccount(this); } } ``` _Delegation of the attachment could also be useful if explicit dependency chaining is used._ **next (later on):** - add `ScpPolicy`, `BackupPolicy`, `TagPolicy`, `AiPolicy` as flavors of `PolicyBase` - add `Organization` construct to enable AWS Organizations - add enabling `PolicyType`, `DelegatedAdministrator`, `TrustedService` Fixes: aws#2877
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
Need help on:
|
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Some thoughts:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For new L2 constructs, we require an approved RFC before we will accept any code. Feel free to keep this open as a draft in the meantime, but please start with an RFC to proceed.
import { IOrganizationalUnit } from './organizational-unit'; | ||
import { CfnAccount } from './organizations.generated'; | ||
|
||
export interface IAccount extends IResource { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoegertn Thank you
@TheRealAmazonKendra aws/aws-cdk-rfcs#465 I'm looking for an API Bar Raiser |
}), | ||
}); | ||
|
||
this.organizationRootId = resource.getResponseField('Roots.0.Id'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoegertn Here is the important lookup needed for the first OUs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, but I was thinking about doing a cx-api lookup and store it in cdk.context.json instead of a CR
poc: how to transition to aws cdk native cfn organizations support - aws/aws-cdk#23001 - aws/aws-cdk-rfcs#465 - aws/aws-cdk#22876 - aws/aws-cdk#22971
/** | ||
* @internal | ||
*/ | ||
public constructor(scope: Construct, id: string, props?: OrganizationRootProps) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be private?
public constructor(scope: Construct, id: string, props: OrganizationalUnitProps) { | ||
super(scope, id); | ||
|
||
const parentId = props.parent?.organizationalUnitId ?? OrganizationRoot.getOrCreate(this).organizationRootId; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we should create the org for the user...
This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
The pull request linter fails with the following errors:
PRs must pass status checks before we can provide a meaningful review. |
features:
Account
,OrganizationalUnit
,Policy
building up the org treeOrganizationRoot
to retrieve the root for the first organizational units (singletonAwsCustomResource
)todo:
inversion of parentship:
It could be useful to inverse the parent child relation, for example
instead of
also it could be useful to inverse the policy attachment
Delegation of the attachment could also be useful if explicit dependency chaining is used.
next (later on):
ScpPolicy
,BackupPolicy
,TagPolicy
,AiPolicy
as flavors ofPolicyBase
Organization
construct to enable AWS OrganizationsPolicyType
,DelegatedAdministrator
,TrustedService
Fixes: #2877
All Submissions:
Adding new Unconventional Dependencies:
New Features
yarn integ
to deploy the infrastructure and generate the snapshot (i.e.yarn integ
without--dry-run
)?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license