Skip to content

Commit

Permalink
fix up
Browse files Browse the repository at this point in the history
  • Loading branch information
NightOwl998 committed Oct 27, 2024
1 parent 533a7a5 commit 4b8c4b4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
10 changes: 5 additions & 5 deletions vault/resource_approle_auth_backend_role_secret_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ func approleAuthBackendRoleSecretIDResource(name string) *schema.Resource {
return false
},
},
//Fadia u have added this

consts.FieldTTL: {
Type: schema.TypeInt,
Required: false,
Optional: true,
ForceNew: true,
Description: "The TTL duration of the SecretID.",
},
//fadia u have added this

consts.FieldNumUses: {
Type: schema.TypeInt,
Required: false,
Expand Down Expand Up @@ -178,11 +178,11 @@ func approleAuthBackendRoleSecretIDCreate(ctx context.Context, d *schema.Resourc
} else {
data["metadata"] = ""
}
//Fadia you just need to check weither the ttl was specified because it is optional.

if v, ok := d.GetOk(consts.FieldTTL); ok {
data["ttl"] = v
}
//Fadia you just need to check weither the num uses was specified because it is optional.

if v, ok := d.GetOk(consts.FieldNumUses); ok {
data["num_uses"] = v
}
Expand Down Expand Up @@ -316,7 +316,7 @@ func approleAuthBackendRoleSecretIDRead(ctx context.Context, d *schema.ResourceD
if err != nil {
return diag.Errorf("error encoding metadata for SecretID %q to JSON: %s", id, err)
}
//fadia you have added this.

ttl := resp.Data["secret_id_ttl"]
numUses := resp.Data["secret_id_num_uses"]
fields := map[string]interface{}{
Expand Down
1 change: 0 additions & 1 deletion vault/resource_approle_auth_backend_role_secret_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ func TestAccAppRoleAuthBackendRoleSecretID_full(t *testing.T) {
resource.TestCheckResourceAttrSet(secretIDResource, "accessor"),
resource.TestCheckResourceAttr(secretIDResource, "cidr_list.#", "2"),
resource.TestCheckResourceAttr(secretIDResource, consts.FieldMetadata, `{"hello":"world"}`),
//fadia
resource.TestCheckResourceAttr(secretIDResource, "ttl", "700"),
resource.TestCheckResourceAttr(secretIDResource, "num_uses", "2"),
),
Expand Down

0 comments on commit 4b8c4b4

Please sign in to comment.