crossplane / crossplane/upjet

Remove cross-references too specific to TR registry examples

Open
#61 0 comments 0 reactions 0 assignees View on GitHub
codegen enhancement v2
Dominant language
Go
Stars
481
Forks
131
Avg merge
2d 1h
Merged PRs (30d)
11

Description

### What problem are you facing?
We started to inject cross-references based on the examples coming from Terraform registry. Sometimes, these references may support multiple types or sometimes do not refer to the leaf reference. For example, [target_host_name](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/hpc_cache_nfs_target), might be a Linux VM or a Microsoft VM. Another example might be `network_interface_id` in [here](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/network_interface_sg_attachment). There exists a separate resource type called `network_interface` but due to this example, we're referring to an EC2 instance to get the value.

Therefore we need to be careful about what we inject while configuring the resources and delete the ones which may not make sense like [here](https://github.com/ulucinar/official-providers/blob/27dae983c979bb05cee871fae5b988a2ab786c7d/provider-azure/config/storagecache/config.go#L26).

### How could Terrajet help solve your problem?

Unfortunately, there is no straightforward solution to this problem. One thing we may implement is traversing references to reach out to the leaf one and use its type in the resolver.

Contributor guide

Open the contributing guide

Research direction

Start by locating the reference resolver and the resource-configuration path; the issue does not name an in-repository file or test. Review the cited storagecache/config.go example and the Terraform Registry cases, then define how traversal should reach a leaf reference and when an injected cross-reference must be removed. Done means the resolver avoids references that are ambiguous or do not match the leaf type.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.