Closed stevendborrelli closed 1 year ago
@muvaf would appreciate if you can take a look at this issue next week.
Looks like we're generating the following:
// value pairs used as parameters for this connection.
// +kubebuilder:validation:Optional
ConnectionPropertiesSecretRef *map[string]github.com/crossplane/crossplane-runtime/apis/common/v1.SecretKeySelector%!(EXTRA string=v1) `json:"connectionPropertiesSecretRef,omitempty" tf:"-"`
for the TF schema given below:
"connection_properties": {
Type: schema.TypeMap,
Optional: true,
Sensitive: true,
ValidateFunc: mapKeyInSlice(glue.ConnectionPropertyKey_Values(), false),
Elem: &schema.Schema{Type: schema.TypeString},
},
It's a bug in Upjet that it's confused seeing a map whose values are sensitive. Though I remember we added support for this case. I'll dig more and update this issue. I don't know of a workaround unfortunately, other than marking it as non-sensitive which defeats the purpose.
One related issue might be the parsing of the config/provider-metadata.yaml
file.
This line in the metadata file:
connection_properties: – (Optional) A map of key-value pairs used as parameters for this connection.
results in this comment (note all the text before -value
is truncated)
// value pairs used as parameters for this connection.
If I remove the dash in key-value
:
connection_properties: – (Optional) A map of key value pairs used as parameters for this connection.
The full comment is generated:
// – A map of key value pairs used as parameters for this connection.
I opened https://github.com/upbound/upjet/pull/135 which fixes the problem but I think the pattern we have there is likely not in line with API conventions https://github.com/upbound/upjet/issues/134 . I'd like us consider changing it before publishing v1beta1 of aws_glue_connection
and having to make a breaking change later. @stevendborrelli We can release AWS as soon as we settle on a decision there without having to wait for Monday release. Does that work for you?
@muvaf works for me!
Fixed with https://github.com/upbound/upjet/pull/138
What happened?
aws_glue_connection
(see code) is marked in the skip list due to terrajet issue #100, which is marked as being closed. I'm not sure if it is fixed in upjet.When trying to use upjet to generate the APIs for this resource, we get the following issue
It looks like line 44 is causing the issue:
The generated go code for
v1beta1/zz_connection_types.go
is:How can we reproduce it?
aws_glue_connection
from the skip list https://github.com/upbound/provider-aws/blob/8b3887c91c4b44dc14e1123b3a5ae1a70e0e45ed/config/provider.go#L93externalname.go
:"aws_glue_connection": config.TemplatedStringAsIdentifier("name", "{{ .parameters.catalog_id }}:{{ .external_name }}"),
make generate