AwsAccountDefaults
Service-level account defaults component for AWS account baseline capabilities.
Remarks
This is the single orchestrating component for account-level default behaviours, including optional default VPC cleanup, deployment IAM roles, regional Serverless Framework deployment-artifact buckets, Grafana access role, composed security groups, and a shared RDS/DocDB subnet group.
Naming:
- Root: type
${namespace}:aws:AwsAccountDefaults; capabilityaccount-defaults; logical-only raw identityargs.identity;${env}-${projectHash}-account-defaults-${sanitiseNamePart(args.identity)}. Punctuation-only values are rejected by the shared builder. - Direct
aws:iam/role:Roleandaws:iam/rolePolicy:RolePolicychildren use[args.identity, 'pulumiDeploymentRole' | 'serverlessDeploymentRole' | 'grafanaAccessRole']. - The enabled
serverlessDeploymentRolecapability creates one directpulumi:providers:awschild using[args.identity]and fixedus-east-1region, plus one directpulumi:providers:aws-nativechild perargs.serverlessDeploymentRole.regions.<region>, using[args.identity, region]. These providers have only their region inputs and therefore use the ambient current AWS session; callers must not configure component providers for this capability. The classic provider owns the global IAM role and policy, while each native provider composes oneAwsS3Bucketper region, with root capabilitys3and raw identityserverlessDeployment<RegionCode>(for exampleserverlessDeploymentEuw1), producing${env}-${projectHash}-s3-serverlessdeploymenteuw1. Each composedaws-native:s3:Bucketchild uses[serverlessDeployment<RegionCode>]. Its S3 provider name usesstackAccountPurpose,${env}-${projectHash}-${accountHash}-serverlessdeploymenteuw1, folding the compact lower-case region code into the globally unique bucket name. These private, ACL-less, AES256-encrypted buckets deny non-HTTPS requests and have versioning, lifecycle expiry, and intelligent tiering deliberately disabled. They support Serverless Framework deployments and are unrelated toAwsServerless. - Direct
pulumi-nodejs:dynamic:Resourcedefault-VPC cleanup markers use[args.identity, args.defaultVpcCleanup.regions.<region>]. The keyed region is a raw AWS region identifier; it is forwarded unchanged to the dynamic provider, which does not own a provider name. - Nested
AwsAccountDefaultsDefaultSecurityGroupscope components are parented byAwsAccountDefaultsand use the intentional target logical-name formula${env}-${projectHash}-${sanitise(args.identity)}-${sanitise(presetKey)}-${sha1([vpcName]).slice(0, 6)}. Their readable anchor isargs.identitythen the preset key; their raw hash payload isargs.defaultSecurityGroups.<vpcName>. The VPC Name tag often begins with the runtime prefix, so the hash avoids duplicating it while retaining each raw map key as a unique scope dimension. Each scope composesAwsSecurityGroup, which retains its established provider name from the fixed preset purpose.defaultSecurityGroupsis a keyed record whose key is the VPC Name tag value. - Direct
aws:rds/subnetGroup:SubnetGroupuses[args.identity, args.rdsAndDocdbSubnetGroup.purpose]. Its providernameremains the lowercasedstackAndPurposeresult from rawargs.rdsAndDocdbSubnetGroup.purpose; RDS owns validation for names up to 255 characters. - Default security-group and shared RDS/DocDB subnet-group AWS names use the
stackAndPurposestyle${env}-${projectHash}-${purpose}. VPC targeting remains part of Pulumi logical identity only and is not included in AWS security-group names. - Exception: the
pulumiDeploymentRole,serverlessDeploymentRole, andgrafanaAccessRoleIAM roles use fixed, unprefixed AWS names (pulumiDeployment,serverlessDeployment, andgrafanaAccess); they are well-known integration roles referenced by external systems, so rawaws.iam.Roleresources with fixed names are used deliberately. Intentional. - Exception: the matching direct
aws:iam/rolePolicy:RolePolicychildren use the same fixed, unprefixed provider names (pulumiDeployment,serverlessDeployment, andgrafanaAccess) as their owning roles. Intentional.
Example
const defaults = new AwsAccountDefaults(
{
identity: 'account-defaults',
defaultVpcCleanup: {
regions: { 'eu-west-1': {}, 'eu-central-1': {} },
},
pulumiDeploymentRole: {
policyDocument: {
path: 'policies/pulumi-deployment-default.json',
},
},
serverlessDeploymentRole: {
regions: { 'eu-central-1': {}, 'eu-west-1': {} },
policyDocument: {
path: 'policies/serverless-deployment-default.json',
},
},
grafanaAccessRole: {
trustPrincipalArns: [
'arn:aws:iam::000000000000:role/roleA',
'arn:aws:iam::000000000000:role/roleB',
],
policyDocument: {
path: 'policies/grafana-access-default.json',
},
},
defaultSecurityGroups: {
production: {},
staging: {},
},
},
);Constructors
new AwsAccountDefaults(
args: AwsAccountDefaultsArgs,
options?: ComponentResourceOptions,
): AwsAccountDefaults
Parameters
args(AwsAccountDefaultsArgs) — Account defaults capability inputs.options(ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.
Returns
AwsAccountDefaults
Hierarchy
ComponentResourceAwsAccountDefaults
Properties
defaultVpcCleanupApplied: OutputInstance<boolean> | undefined
Whether default VPC cleanup was applied (the region currently has no default VPC).
Remarks
Resolves to true after cleanup removed a default VPC or when none existed, and to false when the capability is disabled. A pulumi refresh re-reads current reality, so it reports false if a default VPC reappears.
defaultVpcCleanupAppliedByRegion: Output<AwsAccountDefaultsDefaultVpcCleanupAppliedByRegion> | undefined
Default VPC cleanup state keyed by configured AWS region when configured.
deploymentRoleArn: Output<string> | undefined
Default Pulumi deployment role ARN when configured.
grafanaAccessRoleArn: Output<string> | undefined
Grafana access role ARN when configured.
rdsAndDocdbSubnetGroup: SubnetGroup | undefined
Shared RDS/DocDB DB subnet group created from a referenced VPC when configured.
rdsAndDocdbSubnetGroupName: Output<string> | undefined
Shared RDS/DocDB DB subnet group name when configured.
securityGroupIds: Output<AwsAccountDefaultsSecurityGroupIds> | undefined
Security group IDs keyed first by VPC Name tag value, then by preset group key.
serverlessDeploymentBucketArns: Output<Partial<Record<'eu-central-1' | 'eu-west-1' | 'us-east-1', string>>> | undefined
Serverless Framework deployment-artifact bucket ARNs keyed by configured AWS region.
serverlessDeploymentBucketNames: Output<Partial<Record<'eu-central-1' | 'eu-west-1' | 'us-east-1', string | undefined>>> | undefined
Serverless Framework deployment-artifact bucket names keyed by configured AWS region.
serverlessDeploymentRoleArn: Output<string> | undefined
Serverless deployment role ARN when configured.
urn: Output<string>
Inherited from urn
The stable logical URN used to distinctly address a resource, both before and after deployments.
Methods
getData(): Promise<any>
Inherited from getData
Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.
Returns
Promise<any>
getProvider(moduleMember: string): ProviderResource | undefined
Inherited from getProvider
Returns the provider for the given module member, if one exists.
Parameters
moduleMember(string)
Returns
ProviderResource | undefined
initialize(
args: Inputs,
opts?: ComponentResourceOptions,
name?: string,
type?: string,
): Promise<any>
Inherited from initialize
Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.
Parameters
args(Inputs)opts(ComponentResourceOptions, optional)name(string, optional)type(string, optional)
Returns
Promise<any>
registerOutputs(
outputs?: Inputs | Promise<Inputs> | Output<Inputs>,
): void
Inherited from registerOutputs
Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.
Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.
Parameters
outputs(Inputs | Promise<Inputs> | Output<Inputs>, optional)
Returns
void
Static Methods
isInstance(obj: any): obj is ComponentResource<any>
Inherited from isInstance
Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.
Parameters
obj(any)
Returns
obj is ComponentResource<any>