crossplane / terrajet

Generate Crossplane Providers from any Terraform Provider
https://crossplane.io
Apache License 2.0
289 stars 38 forks source link

Allow API group to be overridden for a generated resource #120

Closed ulucinar closed 2 years ago

ulucinar commented 2 years ago

What problem are you facing?

For certain API groups there are resources that belong to them, which have references in both directions: If, for example, we have API groups a and b, it could be the case that there are resources in a referring to resources in b, and there are resources in b referring to resources in group a. This results in the prohibited import cycles in the generated code when we manually configure the reference fields.

How could Terrajet help solve your problem?

For certain cases, it would help to be able to override the Terraform-implied generated API group of a resource with something similar to:

config.Store.SetForResource("azurerm_virtual_network", config.Resource{
                GV: "networking/v1alpha1",
                ...
        })

, which will generate the VirtualNetwork resource as github.com/crossplane-contrib/provider-tf-azure/apis/networking/v1alpha1.VirtualNetwork instead of the default github.com/crossplane-contrib/provider-tf-azure/apis/virtual/v1alpha1.VirtualNetwork.

muvaf commented 2 years ago

@ulucinar are these duplicates? https://github.com/crossplane-contrib/terrajet/issues/97

turkenh commented 2 years ago

Closed with https://github.com/crossplane-contrib/terrajet/pull/128