Getting AWS Account ID with cdktf

Hey, so I only just started using cdktf, and I’ve been using cdk for quite sometime.

So when I’m deploying a lambda function into AWS with cdktf, how would I retrieve the AWS account ID from in the solution? I’ve been writing in Python, but if there’s some documentation, that would be helpful too.

Thanks!

Using Terraform Registry is an option.
Depending on how you are passing credentials, you might be able to retrieve in other ways as well.

My fault for not really getting familiar with Terraform in general, but looks like I got it working along a similar approach.

    current_account_id = datasources.DataAwsCallerIdentity(
        scope=self,
        id=f"{ns}-account-id",
    ).account_id