Skip to content

Fixing credential type permadiff with json content for inputs/injectors#6

Merged
josh-silvas merged 2 commits intojosh-silvas:mainfrom
quentinleclerc:fix-credential-type
Jun 1, 2024
Merged

Fixing credential type permadiff with json content for inputs/injectors#6
josh-silvas merged 2 commits intojosh-silvas:mainfrom
quentinleclerc:fix-credential-type

Conversation

@quentinleclerc
Copy link
Copy Markdown
Collaborator

@quentinleclerc quentinleclerc commented May 29, 2024

Hello,
I am having an error while updating credential types for inputs and injectors fields (JSON as string). The creation work but then the update was failing. I managed to make it work with this piece of code.

Error: inputs: '' expected type 'string', got unconvertible type 'map[string]interface {}', value: 'map[fields:[map[<content of the JSON>]'

However I still have a permadiff with "white space changes" on the JSON.

The permadiff is gone by using this trick of encode/decode on the resource call side, but it's a bit ugly.

resource "awx_credential_type" "xxxxx" {
  name        = "Cred type name"
  description = "cred type description"
  inputs      = jsonencode(jsondecode(file("./files/credential_type_xxxx/inputs.json")))
  injectors   = jsonencode(jsondecode(file("./files/credential_type_xxxx/injectors.json")))
}

If anyone has some advice on how to fix this. Anyway, at least this PR fixes the update of credential types.

Thanks

@josh-silvas josh-silvas merged commit cb78204 into josh-silvas:main Jun 1, 2024
@quentinleclerc quentinleclerc deleted the fix-credential-type branch June 3, 2024 07:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants