-
Notifications
You must be signed in to change notification settings - Fork 42
/
data_source_jenkins_credential_vault_approle.go
64 lines (59 loc) · 1.78 KB
/
data_source_jenkins_credential_vault_approle.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package jenkins
import (
"context"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)
func dataSourceJenkinsCredentialVaultAppRole() *schema.Resource {
return &schema.Resource{
ReadContext: dataSourceJenkinsCredentialVaultAppRoleRead,
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Description: "The identifier assigned to the credentials.",
Required: true,
},
"domain": {
Type: schema.TypeString,
Description: "The domain namespace that the credentials will be added to.",
Optional: true,
},
"folder": {
Type: schema.TypeString,
Description: "The folder namespace that the credentials will be added to.",
Optional: true,
},
"scope": {
Type: schema.TypeString,
Description: "The Jenkins scope assigned to the credentials.",
Computed: true,
},
"description": {
Type: schema.TypeString,
Description: "The credentials descriptive text.",
Computed: true,
},
"namespace": {
Type: schema.TypeString,
Description: "Namespace of the roles approle backend.",
Optional: true,
},
"path": {
Type: schema.TypeString,
Description: "Path of the roles approle backend.",
Computed: true,
},
"role_id": {
Type: schema.TypeString,
Description: "The roles role_id.",
Computed: true,
},
},
}
}
func dataSourceJenkinsCredentialVaultAppRoleRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
name := d.Get("name").(string)
folderName := d.Get("folder").(string)
d.SetId(formatFolderName(folderName + "/" + name))
return resourceJenkinsCredentialVaultAppRoleRead(ctx, d, meta)
}