terraform-cdk
                                
                                 terraform-cdk copied to clipboard
                                
                                    terraform-cdk copied to clipboard
                            
                            
                            
                        CDKTF version <0.19 creates duplicates in schema with new Fivetran provider
Expected Behavior
Generated Terraform code without errors. Is transforming snake_case to camelCase expected?
Actual Behavior
CDKTF tranfforms snake_case to camelCase which creates duplicates in schema:
> tsc -p tsconfig.build.json
.gen/providers/fivetran/connector/index.ts:7605:12 - error TS2300: Duplicate identifier 's3Bucket'.
7605   readonly s3Bucket?: string;
                ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:7634:12 - error TS2300: Duplicate identifier 's3RoleArn'.
7634   readonly s3RoleArn?: string;
                ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:7642:12 - error TS2300: Duplicate identifier 's3Bucket'.
7642   readonly s3Bucket?: string;
                ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:7671:12 - error TS2300: Duplicate identifier 's3RoleArn'.
7671   readonly s3RoleArn?: string;
                ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18667:14 - error TS2300: Duplicate identifier 's3Bucket'.
18667   public get s3Bucket() {
                   ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18670:14 - error TS2300: Duplicate identifier 's3Bucket'.
18670   public set s3Bucket(value: string) {
                   ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18673:10 - error TS2393: Duplicate function implementation.
18673   public resetS3Bucket() {
               ~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18677:14 - error TS2300: Duplicate identifier 's3BucketInput'.
18677   public get s3BucketInput() {
                   ~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18731:14 - error TS2300: Duplicate identifier 's3RoleArn'.
18731   public get s3RoleArn() {
                   ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18734:14 - error TS2300: Duplicate identifier 's3RoleArn'.
18734   public set s3RoleArn(value: string) {
                   ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18737:10 - error TS2393: Duplicate function implementation.
18737   public resetS3RoleArn() {
               ~~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18741:14 - error TS2300: Duplicate identifier 's3RoleArnInput'.
18741   public get s3RoleArnInput() {
                   ~~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18746:11 - error TS2300: Duplicate identifier '_s3Bucket'.
18746   private _s3Bucket?: string;
                ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18747:14 - error TS2300: Duplicate identifier 's3Bucket'.
18747   public get s3Bucket() {
                   ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18750:14 - error TS2300: Duplicate identifier 's3Bucket'.
18750   public set s3Bucket(value: string) {
                   ~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18753:10 - error TS2393: Duplicate function implementation.
18753   public resetS3Bucket() {
               ~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18757:14 - error TS2300: Duplicate identifier 's3BucketInput'.
18757   public get s3BucketInput() {
                   ~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18810:11 - error TS2300: Duplicate identifier '_s3RoleArn'.
18810   private _s3RoleArn?: string;
                ~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18811:14 - error TS2300: Duplicate identifier 's3RoleArn'.
18811   public get s3RoleArn() {
                   ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18814:14 - error TS2300: Duplicate identifier 's3RoleArn'.
18814   public set s3RoleArn(value: string) {
                   ~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18817:10 - error TS2393: Duplicate function implementation.
18817   public resetS3RoleArn() {
               ~~~~~~~~~~~~~~
.gen/providers/fivetran/connector/index.ts:18821:14 - error TS2300: Duplicate identifier 's3RoleArnInput'.
18821   public get s3RoleArnInput() {
                   ~~~~~~~~~~~~~~
.gen/providers/fivetran/data-fivetran-connector/index.ts:2958:14 - error TS2300: Duplicate identifier 's3Bucket'.
2958   public get s3Bucket() {
                  ~~~~~~~~
.gen/providers/fivetran/data-fivetran-connector/index.ts:2978:14 - error TS2300: Duplicate identifier 's3RoleArn'.
2978   public get s3RoleArn() {
                  ~~~~~~~~~
.gen/providers/fivetran/data-fivetran-connector/index.ts:2983:14 - error TS2300: Duplicate identifier 's3Bucket'.
2983   public get s3Bucket() {
                  ~~~~~~~~
.gen/providers/fivetran/data-fivetran-connector/index.ts:3003:14 - error TS2300: Duplicate identifier 's3RoleArn'.
3003   public get s3RoleArn() {
                  ~~~~~~~~~
Found 26 errors in 2 files.
Errors  Files
    22  .gen/providers/fivetran/connector/index.ts:7605
     4  .gen/providers/fivetran/data-fivetran-connector/index.ts:2958
Steps to Reproduce
import { Construct } from 'constructs'; import * as fivetran from '../../../.gen/providers/fivetran';
export class FivetranGroup extends Construct { constructor( scope: Construct, id: string, ) { super(scope, id); }
readonly group = new fivetran.group.Group(this, 'example-group', { name: "example-group", });
}
Versions
Fivetran version: 1.1.11 cdktf version: 0.18.0
Providers
No response
Gist
No response
Possible Solutions
No response
Workarounds
No response
Anything Else?
Is there any tool, or setting that allows CDKTF to handle such cases on schema mapping?
References
No response
Help Wanted
- [ ] I'm interested in contributing a fix myself
Community Note
- Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
- Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
- If you are interested in working on this issue or have submitted a pull request, please leave a comment
Hi @NemanjaMilenkovic 👋
Thanks for raising this! I just tried to replicate your problem with the latest CDKTF version (0.20.3) and was unable to do so. It seemed to work for me.
Is transforming snake_case to camelCase expected?
Yes that is expected as CDKTF tries to match the common casing for each target language.
Can you try whether upgrading to CDKTF 0.20.3 fixes your problem? There have been recent fixes related to the problem you are seeing. Although, I think they were related to modules 🤔
If the problem persists, could you post more of your configuration (cdktf.json) or even a link to a reproducible example? 😊
That said, there seems to be s3Bucket and s3_bucket in the fivetran_connector resource and they seem to do different things. This will cause problems in CDKTF, if the s3Bucket needs to be set as they collide as far as CDKTF is concerned. To solve this, a manual override could be used (e.g. myConnectorResource.addOverride("s3Bucket", "my-bucket")) – but I haven't tested that. In general CDKTF assumes snake_cased attribute names, which is why this Terraform provider might not be 100% supported currently.
Hi @ansgarm 👋 Thank you for looking into this!
Yes, as you noticed - that is correct - CDKTF 0.20.3 works as expected. Also, every CDKTF version higher than 0.19 works with no issues.
Our main question was about the difference in CDKTF behaviour in versions before CDKTF version 0.19 and after where schema might be mapped differently but I can't seem to find a reason why or a documented breaking change that would explain it.
This is an example configuration where it is noticed:
Fivetran version: 1.1.11 cdktf version: 0.18.0 (or any version < 0.19.0)
Note: in our current use case, we need to use Fivetran version: 1.1.11 but we would prefer not upgrading CDKTF above version 0.19.0 at this moment.
If CDKTF version > 0.19.0 is used, including the latest CDKTF 0.20.3, there are no issues.
Is there a difference in how CDKTF is handling casing before version 0.19.0 and after?
Hi @ansgarm Just in case you've missed this - is there any additional information needed?