This repository has been archived by the owner on Sep 24, 2020. It is now read-only.
forked from CiscoDevNet/terraform-provider-aci
-
Notifications
You must be signed in to change notification settings - Fork 6
/
data_source_aci_cloudawsprovider.go
101 lines (80 loc) · 1.95 KB
/
data_source_aci_cloudawsprovider.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package aci
import (
"fmt"
"github.com/ciscoecosystem/aci-go-client/client"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)
func dataSourceAciCloudAWSProvider() *schema.Resource {
return &schema.Resource{
Read: dataSourceAciCloudAWSProviderRead,
SchemaVersion: 1,
Schema: AppendBaseAttrSchema(map[string]*schema.Schema{
"tenant_dn": &schema.Schema{
Type: schema.TypeString,
Required: true,
},
"access_key_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"account_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"email": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"http_proxy": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"is_account_in_org": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"is_trusted": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"name_alias": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"provider_id": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"region": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"secret_access_key": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
}),
}
}
func dataSourceAciCloudAWSProviderRead(d *schema.ResourceData, m interface{}) error {
aciClient := m.(*client.Client)
rn := fmt.Sprintf("awsprovider")
TenantDn := d.Get("tenant_dn").(string)
dn := fmt.Sprintf("%s/%s", TenantDn, rn)
cloudAwsProvider, err := getRemoteCloudAWSProvider(aciClient, dn)
if err != nil {
return err
}
setCloudAWSProviderAttributes(cloudAwsProvider, d)
return nil
}