Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
Breaking changes
Since the long-term support for Node.js 16 ended on 2023-09-11, we updated our minimum compatible Node.js version to 18.12.
moveTo
on TerraformResource
We have added support for resource refactoring and renaming with the addition of the instance function moveTo
on TerraformResource
. We forsee the potential for naming collision with providers using moveTo
as an attribute. In instances where provider bindings fail to compile due to the collision, regenerate your provider bindings and replace the provider related usage of moveTo
to moveToAttribute
in your configuration if applicable.
codeMakerOutput
needs to be set to a company identifierWe did not honor the codeMakerOutput
setting in the cdktf.json
previously, this is fixed now.
To have no changes in the generated code you can set codeMakerOutput: "imports"
.
If you like, you can now set it to your company name, e.g. codeMakerOutput: "com.hashicorp"
so that the provider is generated under the com.hashicorp.aws
namespace for example. Omitting the codeMakerOutput
will lead to the default value .gen
being used and results in an error.
Fixes a bug in 0.18.1 that broke crash reporting due to a partial dependency upgrade.
Breaking changes
When using a Provider in python one could previously import the resource and data source namespaces on the root level. This is no longer possible and the namespaces must be imported through specifying the paht in the import. The syntax was supported before as well, so you can change your code within 0.17.x
and then upgrade to 0.18.x
.
Before:
from constructs import Construct
from cdktf import App, TerraformStack
from imports.aws import provider, sns_topic, lambda_function, iam_role
class MyStack(TerraformStack):
def __init__(self, scope: Construct, ns: str):
super().__init__(scope, ns)
provider.AwsProvider(self, 'Aws', region='eu-central-1')
sns_topic.SnsTopic(self, 'Topic', display_name='my-first-sns-topic')
role = iam_role.IamRole(self, 'Role', name='lambda-role',
assume_role_policy='{}')
lambda_function.LambdaFunction(self, 'Lambda', function_name='my-first-lambda-function',
role=role.arn, handler='index.handler', runtime='python3.6')
app = App()
MyStack(app, "before-change")
app.synth()
After:
from constructs import Construct
from cdktf import App, TerraformStack
from imports.aws.provider import AwsProvider
from imports.aws.sns_topic import SnsTopic
from imports.aws.lambda_function import LambdaFunction
from imports.aws.iam_role import IamRole
class MyStack(TerraformStack):
def __init__(self, scope: Construct, ns: str):
super().__init__(scope, ns)
AwsProvider(self, 'Aws', region='eu-central-1')
SnsTopic(self, 'Topic', display_name='my-first-sns-topic')
role = IamRole(self, 'Role', name='lambda-role',
assume_role_policy='{}')
LambdaFunction(self, 'Lambda', function_name='my-first-lambda-function',
role=role.arn, handler='index.handler', runtime='python3.6')
app = App()
MyStack(app, "after-change")
app.synth()
In 0.16.2
the release to maven failed, we fixed the issue and release this version so that maven is included in the release.