@@ -2,7 +2,6 @@ package awx
22
33import (
44 "context"
5- "encoding/json"
65 "strconv"
76
87 "github.com/hashicorp/terraform-plugin-sdk/v2/diag"
@@ -42,7 +41,7 @@ func resourceCredential() *schema.Resource {
4241 Description : "Specify the type of credential you want to create. Refer to the Ansible Tower documentation for details on each type" ,
4342 },
4443 "inputs" : {
45- Type : schema .TypeString ,
44+ Type : schema .TypeMap ,
4645 Required : true ,
4746 Sensitive : true ,
4847 Description : "The inputs to be created with the credential." ,
@@ -52,11 +51,7 @@ func resourceCredential() *schema.Resource {
5251}
5352
5453func resourceCredentialCreate (ctx context.Context , d * schema.ResourceData , m interface {}) diag.Diagnostics {
55- inputs := d .Get ("inputs" ).(string )
56- inputsMap := make (map [string ]interface {})
57- if err := json .Unmarshal ([]byte (inputs ), & inputsMap ); err != nil {
58- return utils .DiagCreate (diagCredentialTitle , err )
59- }
54+ inputsMap := d .Get ("inputs" )
6055
6156 payload := map [string ]interface {}{
6257 "name" : d .Get ("name" ).(string ),
@@ -115,11 +110,7 @@ func resourceCredentialUpdate(ctx context.Context, d *schema.ResourceData, m int
115110 if d .HasChanges (keys ... ) {
116111 var err error
117112
118- inputs := d .Get ("inputs" ).(string )
119- inputsMap := make (map [string ]interface {})
120- if err := json .Unmarshal ([]byte (inputs ), & inputsMap ); err != nil {
121- return utils .DiagUpdate (diagCredentialTitle , d .Id (), err )
122- }
113+ inputsMap := d .Get ("inputs" )
123114
124115 id , err := strconv .Atoi (d .Id ())
125116 if err != nil {
@@ -139,7 +130,7 @@ func resourceCredentialUpdate(ctx context.Context, d *schema.ResourceData, m int
139130 }
140131 }
141132
142- return resourceCredentialSCMRead (ctx , d , m )
133+ return resourceCredentialRead (ctx , d , m )
143134}
144135
145136func resourceCredentialDelete (_ context.Context , d * schema.ResourceData , m interface {}) diag.Diagnostics {
0 commit comments