-
Notifications
You must be signed in to change notification settings - Fork 4k
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
refactor(core): revisit the Stack API #2818
Conversation
BREAKING CHANGE: * **core:** `stack.name` renamed to `stack.stackName` * **core:** `stack.stackName` will return the concrete stack name. Use `Aws.stackName` to indicate { Ref: "AWS::StackName" }. * **core:** `stack.account` and `stack.region` will return the concrete account/region only if they are explicitly specified when the stack is defined (under the `env` prop). Otherwise, they will return a token that resolves to the AWS::AccountId and AWS::Region intrinsic references. Use `Context.getDefaultAccount()` and `Context.getDefaultRegion()` to obtain the defaults passed through the toolkit in case those are needed. Use `Token.isUnresolved(v)` to check if you have a concrete or intrinsic. * **core:** `stack.logicalId` has been removed. Use `stack.getLogicalId()` * **core:** `stack.env` has been removed, use `stack.account`, `stack.region` and `stack.environment` instead * **core:** `stack.accountId` renamed to `stack.account` (to allow treating account more abstractly) * **core:** `AvailabilityZoneProvider` can now be accessed through `Context.getAvailabilityZones()` * **core:** `SSMParameterProvider` can now be accessed through `Context.getSsmParameter()` * **core:** `parseArn` is now `Arn.parse` * **core:** `arnFromComponents` is now `arn.format` * **core:** `node.lock` and `node.unlock` are now private * **core:** `stack.requireRegion` and `requireAccountId` have been removed. Use `Token.unresolved(stack.region)` instead * **core:** `stack.parentApp` have been removed. Use `App.isApp(stack.node.root)` instead. * **core:** `stack.missingContext` is now private * **core:** `stack.renameLogical` have been renamed to `stack.renameLogicalId` * **core:** `IAddressingScheme`, `HashedAddressingScheme` and `LogicalIDs` are now internal. Override `Stack.allocateLogicalId` to customize how logical IDs are allocated to resources.
Fixes aws#2728 BREAKING CHANGE: multiple changes to the `Stack` API * **core:** `stack.name` renamed to `stack.stackName` * **core:** `stack.stackName` will return the concrete stack name. Use `Aws.stackName` to indicate { Ref: "AWS::StackName" }. * **core:** `stack.account` and `stack.region` will return the concrete account/region only if they are explicitly specified when the stack is defined (under the `env` prop). Otherwise, they will return a token that resolves to the AWS::AccountId and AWS::Region intrinsic references. Use `Context.getDefaultAccount()` and `Context.getDefaultRegion()` to obtain the defaults passed through the toolkit in case those are needed. Use `Token.isUnresolved(v)` to check if you have a concrete or intrinsic. * **core:** `stack.logicalId` has been removed. Use `stack.getLogicalId()` * **core:** `stack.env` has been removed, use `stack.account`, `stack.region` and `stack.environment` instead * **core:** `stack.accountId` renamed to `stack.account` (to allow treating account more abstractly) * **core:** `AvailabilityZoneProvider` can now be accessed through `Context.getAvailabilityZones()` * **core:** `SSMParameterProvider` can now be accessed through `Context.getSsmParameter()` * **core:** `parseArn` is now `Arn.parse` * **core:** `arnFromComponents` is now `arn.format` * **core:** `node.lock` and `node.unlock` are now private * **core:** `stack.requireRegion` and `requireAccountId` have been removed. Use `Token.unresolved(stack.region)` instead * **core:** `stack.parentApp` have been removed. Use `App.isApp(stack.node.root)` instead. * **core:** `stack.missingContext` is now private * **core:** `stack.renameLogical` have been renamed to `stack.renameLogicalId` * **core:** `IAddressingScheme`, `HashedAddressingScheme` and `LogicalIDs` are now internal. Override `Stack.allocateLogicalId` to customize how logical IDs are allocated to resources.
@eladb Hi, I'm trying to figure out a way to easily remove the logicalId prefix to all the resources within a stack, and found aws-cdk/packages/@aws-cdk/core/lib/stack.ts Line 247 in 82e08bc
/**
* Rename a generated logical identities
*
* To modify the naming scheme strategy, extend the `Stack` class and
* override the `createNamingScheme` method.
*/
public renameLogicalId(oldId: string, newId: string) {
this._logicalIds.addRename(oldId, newId);
} however I don't see any reference to |
Thanks so much for taking the time to contribute to the AWS CDK ❤️ We will shortly assign someone to review this pull request and help get it
|
Fixes #2728
BREAKING CHANGE:
stack.name
renamed tostack.stackName
stack.stackName
will return the concrete stack name. UseAws.stackName
to indicate { Ref: "AWS::StackName" }.stack.account
andstack.region
will return the concrete account/region only if they are explicitly specified when the stack is defined (under theenv
prop). Otherwise, they will return a token that resolves to the AWS::AccountId and AWS::Region intrinsic references. UseContext.getDefaultAccount()
andContext.getDefaultRegion()
to obtain the defaults passed through the toolkit in case those are needed. UseToken.isUnresolved(v)
to check if you have a concrete or intrinsic.stack.logicalId
has been removed. Usestack.getLogicalId()
stack.env
has been removed, usestack.account
,stack.region
andstack.environment
insteadstack.accountId
renamed tostack.account
(to allow treating account more abstractly)AvailabilityZoneProvider
can now be accessed throughContext.getAvailabilityZones()
SSMParameterProvider
can now be accessed throughContext.getSsmParameter()
parseArn
is nowArn.parse
arnFromComponents
is nowarn.format
node.lock
andnode.unlock
are now privatestack.requireRegion
andrequireAccountId
have been removed. UseToken.unresolved(stack.region)
insteadstack.parentApp
have been removed. UseApp.isApp(stack.node.root)
instead.stack.missingContext
is now privatestack.renameLogical
have been renamed tostack.renameLogicalId
IAddressingScheme
,HashedAddressingScheme
andLogicalIDs
are now internal. OverrideStack.allocateLogicalId
to customize how logical IDs are allocated to resources.Pull Request Checklist
design
folderBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license.