diff --git a/pkg/config/resource.go b/pkg/config/resource.go index 054f3f9b..c367708a 100644 --- a/pkg/config/resource.go +++ b/pkg/config/resource.go @@ -301,4 +301,9 @@ type Resource struct { // MetaResource is the metadata associated with the resource scraped from // the Terraform registry. MetaResource *registry.Resource + + // Path is the resource path for the API server endpoint. It defaults to + // the plural name of the generated CRD. Overriding this sets both the + // path and the plural name for the generated CRD. + Path string } diff --git a/pkg/pipeline/crd.go b/pkg/pipeline/crd.go index 2e0ef898..41b89bf9 100644 --- a/pkg/pipeline/crd.go +++ b/pkg/pipeline/crd.go @@ -90,6 +90,7 @@ func (cg *CRDGenerator) Generate(cfg *config.Resource) (string, error) { "Kind": cfg.Kind, "ForProviderType": gen.ForProviderType.Obj().Name(), "AtProviderType": gen.AtProviderType.Obj().Name(), + "Path": cfg.Path, }, "Provider": map[string]string{ "ShortName": cg.ProviderShortName, diff --git a/pkg/pipeline/templates/crd_types.go.tmpl b/pkg/pipeline/templates/crd_types.go.tmpl index 41a485f0..4a95c1bf 100644 --- a/pkg/pipeline/templates/crd_types.go.tmpl +++ b/pkg/pipeline/templates/crd_types.go.tmpl @@ -33,7 +33,7 @@ type {{ .CRD.Kind }}Status struct { // +kubebuilder:printcolumn:name="EXTERNAL-NAME",type="string",JSONPath=".metadata.annotations.crossplane\\.io/external-name" // +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,{{ .Provider.ShortName }}} +// +kubebuilder:resource:scope=Cluster,categories={crossplane,managed,{{ .Provider.ShortName }}}{{ if .CRD.Path }},path={{ .CRD.Path }}{{ end }} type {{ .CRD.Kind }} struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"`