Open pschisa opened 3 years ago
Tested using an explicit resource name and the results are the same output ([] in JSON for a list even though its only one item):
# tctl get oidc/Keycloak --format=json
[
{
"kind": "oidc",
"version": "v2",
"metadata": {
"name": "Keycloak"
},
"spec": {
"issuer_url": "https://keycloak.schisa.cf/auth/realms/teleport-login",
"client_id": "teleport-keycloak",
"client_secret": "",
"redirect_url": "https://test-cluster1.schisa.cf/v1/webapi/oidc/callback",
"scope": [
"groups",
"profile"
],
"claims_to_roles": [
{
"claim": "groups",
"value": "teleport-admins",
"roles": [
"admin"
]
}
]
}
}
]
Description
What happened: When using
tctl get <resource> --format=json > resource-file.txt
to produce json formated file, the resulting json output is formatted incorrectly to use with thetctl create
command, at least for oidc and saml single resources. Example below:It is worth noting that it seems to be an issue with the output presenting and array {} within a list []. Removing the outermost [] gets around the issue and allows the json resource to work with the
tctl create
commandWhat you expected to happen: The output of
tctl get <resource> --format=json
will work with thetctl create
command without requiring any editing (like it does with the yaml format)Reproduction Steps
As minimally and precisely as possible, describe step-by-step how to reproduce the problem.
tctl get oidc --format=json > oidc.json
on the auth servertctl create -f oidc.json
on the auth serverServer Details
Workaround
Remove the first "[" and the last "]" after running
tctl get
, save the file, then runtctl create