org-formation / aws-resource-providers

A community driven repository where you can find AWS Resource Type Providers for different purposes (including org-formation ones).
MIT License
88 stars 21 forks source link

Community::Support::SupportLevel #44

Open OlafConijn opened 3 years ago

OlafConijn commented 3 years ago

Resource should allow settings the SupportLevel for an Account within the organization through a support ticket.

This because it is currently not possible to automate this process. org-formation, but also ADF use this mechanism to automate setting support level on new member-accounts.

Type: Community::Support::SupportLevel
Properties: 
  SupportLevel: 'developer' | 'business' | 'enterprise'
  AccountId: String # \d{12}
  CCEmailAddresses: List<String> # list of emailaddresses need to be included on the support case.

Type must be deployed to master account, where the support case will be created as follows: The Support API is only supported on AWS Accounts that have business or enterprise support enabled. Resource will expect to fail if the support level is less.

 const createCaseRequest: CreateCaseRequest = {
    subject: `Enable ${resource.supportLevel} Support for account: ${accountId}`,
    communicationBody: `Hi AWS,
Please enable ${resource.supportLevel} on account ${accountId}.
This case was created automatically - please resolve when done.

Thank you!
    `,
    serviceCode: 'customer-account',
    categoryCode: 'other-account-issues',
    severityCode: 'low',
    issueType: 'customer-service',
    ccEmailAddresses: [resource.rootEmail],
};

Intended use using org-formation syntax:


DevelopmentAccountsHaveDeveloperSupport:
  Type: Community::Support::SupportLevel
  OrganizationBinding: !Ref masterAccountBinding
  ForeachAccount: !Ref developmentAccountsBinding
  Properties: 
    SupportLevel: 'developer'
    AccountId: !Ref CurrentAccount
    CCEmailAdresses: 
    - aws@myorg.com
    - !GetAtt CurrentAccount.RootEmail

ProductionsAccountsHaveBusinessSupport:
  Type: Community::Support::SupportLevel
  OrganizationBinding: !Ref masterAccountBinding
  ForeachAccount: !Ref productionAccountsBinding
  Properties: 
    SupportLevel: 'business'
    AccountId: !Ref CurrentAccount
    CCEmailAdresses: 
    - aws@myorg.com
    - !GetAtt CurrentAccount.RootEmail