hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.84k stars 450 forks source link

newS3Bucket Go SDK Fails Compile #3718

Closed crayon-sr closed 4 weeks ago

crayon-sr commented 1 month ago

Expected Behavior

No duplicate interfaces in autogenerated SDK

Actual Behavior

Cannot create a bucket, with following error.

go/pkg/mod/github.com/cdktf/cdktf-provider-aws-go/aws/v10@v10.0.12/s3bucket/s3bucket_S3Bucket.go:14:2: duplicate method Count go/pkg/mod/github.com/cdktf/cdktf-provider-aws-go/aws/v10@v10.0.12/s3bucket/s3bucket_S3Bucket.go:41:2: other declaration of Count go/pkg/mod/github.com/cdktf/cdktf-provider-aws-go/aws/v10@v10.0.12/s3bucket/s3bucket_S3Bucket.go:14:2: duplicate method SetCount go/pkg/mod/github.com/cdktf/cdktf-provider-aws-go/aws/v10@v10.0.12/s3bucket/s3bucket_S3Bucket.go:43:2: other declaration of SetCount

Steps to Reproduce


package main

import (
    "github.com/aws/constructs-go/constructs/v10"
    "github.com/aws/jsii-runtime-go"
    "github.com/cdktf/cdktf-provider-aws-go/aws/v10/s3bucket"

    "github.com/hashicorp/terraform-cdk-go/cdktf"
)

func NewMyStack(scope constructs.Construct, id string) cdktf.TerraformStack {
    stack := cdktf.NewTerraformStack(scope, &id)

    s3bucket.NewS3Bucket(scope, jsii.String("my-bucket"),
        &s3bucket.S3BucketConfig{})

    return stack
}

func main() {
    app := cdktf.NewApp(nil)
    NewMyStack(app, "my-bucket")
    app.Synth()
}```

### Versions

language: go
cdktf-cli: 0.20.8
node: v22.5.1
cdktf: 0.20.8
constructs: 10.3.0
jsii: 1.98.0
terraform: 1.9.5
arch: arm64
os: darwin 23.6.0
go: go version go1.22.5 darwin/arm64
providers
github.com/cdktf/cdktf-provider-aws-go/aws (PREBUILT)
        terraform provider version: 4.39.0 
        prebuilt provider version: 10.0.12
        cdktf version: ^0.13.0

### Providers

┌───────────────┬──────────────────┬─────────┬────────────┬────────────────────────────────────────────┬─────────────────┐
│ Provider Name │ Provider Version │ CDKTF   │ Constraint │ Package Name                               │ Package Version │
├───────────────┼──────────────────┼─────────┼────────────┼────────────────────────────────────────────┼─────────────────┤
│ aws           │ 4.39.0           │ ^0.13.0 │            │ github.com/cdktf/cdktf-provider-aws-go/aws │ 10.0.12         │
└───────────────┴──────────────────┴─────────┴────────────┴────────────────────────────────────────────┴─────────────────┘

### Gist

_No response_

### Possible Solutions

Something about embedded interfaces in Go, I am not very familiar with the language. 

### Workarounds

Comment out the overlapping method definitions in the s3bucket_S3Bucket.go S3Bucket interface, and comment out the func defintions.

### Anything Else?

_No response_

### References

_No response_

### Help Wanted

- [ ] I'm interested in contributing a fix myself

### Community Note

- Please vote on this issue by adding a 👍 [reaction](https://blog.github.com/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/) 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
crayon-sr commented 4 weeks ago

Ignore tutorial requirements and bump versions from go.mod located here.