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.79k stars 442 forks source link

fix(cli): sanitize type arrays #3578

Closed DanielMSchmidt closed 3 months ago

DanielMSchmidt commented 3 months ago

Some providers sporadically return them double leading to errors in cdktf convert and get

Fixes #3526 Fixes #3170

DanielMSchmidt commented 3 months ago

Yeah, I just did, it worked out fine :)

$ echo 'resource "ovh_cloud_project_kube" "my_kube_cluster" {
                                                                                              name         = "my_kube_cluster_cdktf"
                                                                                              region       = "GRA7"
                                                                                            }' | /Users/dschmidt/work/cdktf/terraform-cdk/packages/cdktf-cli/bundle/bin/cdktf convert --language go --provider 'ovh/ovh'

import "github.com/aws/constructs-go/constructs"
/*
 * Provider bindings are generated by running `cdktf get`.
 * See https://cdk.tf/provider-generation for more details.
 */
import "cdk.tf/go/stack/generated/ovh/cloudprojectkube"
type myConfig struct {
        serviceName interface{}
}
type myConvertedCode struct {
        construct
}

func newMyConvertedCode(scope construct, name *string, config myConfig) *myConvertedCode {
        this := &myConvertedCode{}
        newConstruct_Override(this, scope, name)
        genprovidersovhcloudprojectkube.NewCloudProjectKube(this, jsii.String("my_kube_cluster"), &cloudProjectKubeConfig{
                name: jsii.String("my_kube_cluster_cdktf"),
                region: jsii.String("GRA7"),
                serviceName: config.serviceName,
        })
        return this
}
github-actions[bot] commented 2 months ago

I'm going to lock this pull request because it has been closed for 30 days. This helps our maintainers find and focus on the active issues. If you've found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.