Skip to content

Commit

Permalink
terraform-provider-sdm: regenerate and revendor Terraform provider
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 153c6d49270dce3fcc0c1dea98e829ca61c65b1f
  • Loading branch information
etodd authored and SupportSDM committed Nov 18, 2020
1 parent cbd5c57 commit 9f74642
Show file tree
Hide file tree
Showing 1,152 changed files with 169,682 additions and 106,782 deletions.
6 changes: 6 additions & 0 deletions docs/data-sources/secret_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The following arguments are supported by a SecretStores data source:
* `client_key_path` - (Optional)
* `id` - (Optional) Unique identifier of the SecretStore.
* `name` - (Optional) Unique human-readable name of the SecretStore.
* `region` - (Optional)
* `server_address` - (Optional)
## Attribute Reference
In addition to provided arguments above, the following attributes are returned by a SecretStores data source:
Expand All @@ -36,3 +37,8 @@ In addition to provided arguments above, the following attributes are returned b
* `name` - Unique human-readable name of the SecretStore.
* `server_address` -
* `tags` - Tags is a map of key, value pairs.
* aws:
* `id` - Unique identifier of the SecretStore.
* `name` - Unique human-readable name of the SecretStore.
* `region` -
* `tags` - Tags is a map of key, value pairs.
3 changes: 3 additions & 0 deletions docs/resources/secret_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ The following arguments are supported by the SecretStore resource:
* vault_token:
* `name` - (Required) Unique human-readable name of the SecretStore.
* `server_address` - (Required)
* aws:
* `name` - (Required) Unique human-readable name of the SecretStore.
* `region` - (Required)
## Attribute Reference
In addition to provided arguments above, the following attributes are returned by the SecretStore resource:
* `id` - A unique identifier for the SecretStore resource.
7 changes: 5 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module github.com/strongdm/terraform-provider-sdm
go 1.13

require (
github.com/hashicorp/terraform-plugin-sdk v1.7.0
github.com/strongdm/strongdm-sdk-go v0.9.20
github.com/google/uuid v1.1.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.13.0 // indirect
github.com/hashicorp/terraform-plugin-sdk v1.16.0
github.com/hashicorp/terraform-plugin-test v1.2.0 // indirect
github.com/strongdm/strongdm-sdk-go v0.9.21
google.golang.org/protobuf v1.25.0 // indirect
)
292 changes: 292 additions & 0 deletions go.sum

Large diffs are not rendered by default.

48 changes: 48 additions & 0 deletions sdm/data_source_secret_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ func dataSourceSecretStore() *schema.Resource {
Type: schema.TypeString,
Optional: true,
},
"region": {
Type: schema.TypeString,
Optional: true,
},
"server_address": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -127,6 +131,39 @@ func dataSourceSecretStore() *schema.Resource {
"tags": {
Type: schema.TypeMap,

Elem: &schema.Schema{
Type: schema.TypeString,
},
Optional: true,
Description: "Tags is a map of key, value pairs.",
},
},
},
},
"aws": {
Type: schema.TypeList,
Computed: true,
Description: "",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"id": {
Type: schema.TypeString,
Optional: true,
Description: "Unique identifier of the SecretStore.",
},
"name": {
Type: schema.TypeString,
Optional: true,
Description: "Unique human-readable name of the SecretStore.",
},
"region": {
Type: schema.TypeString,
Optional: true,
Description: "",
},
"tags": {
Type: schema.TypeMap,

Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down Expand Up @@ -173,6 +210,10 @@ func convertSecretStoreFilterFromResourceData(d *schema.ResourceData) (string, [
filter += "name:? "
args = append(args, v)
}
if v, ok := d.GetOk("region"); ok {
filter += "region:? "
args = append(args, v)
}
if v, ok := d.GetOk("server_address"); ok {
filter += "serveraddress:? "
args = append(args, v)
Expand Down Expand Up @@ -218,6 +259,13 @@ func dataSourceSecretStoreList(d *schema.ResourceData, cc *sdm.Client) error {
"server_address": (v.ServerAddress),
"tags": convertTagsToMap(v.Tags),
})
case *sdm.AWSStore:
output[0]["aws"] = append(output[0]["aws"], entity{
"id": (v.ID),
"name": (v.Name),
"region": (v.Region),
"tags": convertTagsToMap(v.Tags),
})
}
}
if resp.Err() != nil {
Expand Down
3 changes: 3 additions & 0 deletions sdm/resource_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func resourceAccountCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertAccountFromResourceData(d)

resp, err := cc.Accounts().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create Account: %w", err)
Expand Down Expand Up @@ -174,6 +175,7 @@ func resourceAccountRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertAccountFromResourceData(d)
_ = localVersion

resp, err := cc.Accounts().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down Expand Up @@ -218,6 +220,7 @@ func resourceAccountRead(d *schema.ResourceData, cc *sdm.Client) error {
func resourceAccountUpdate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutUpdate))
defer cancel()

resp, err := cc.Accounts().Update(ctx, convertAccountFromResourceData(d))
if err != nil {
return fmt.Errorf("cannot update Account %s: %w", d.Id(), err)
Expand Down
2 changes: 2 additions & 0 deletions sdm/resource_account_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func resourceAccountAttachmentCreate(d *schema.ResourceData, cc *sdm.Client) err
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertAccountAttachmentFromResourceData(d)

resp, err := cc.AccountAttachments().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create AccountAttachment: %w", err)
Expand All @@ -68,6 +69,7 @@ func resourceAccountAttachmentRead(d *schema.ResourceData, cc *sdm.Client) error
defer cancel()
localVersion := convertAccountAttachmentFromResourceData(d)
_ = localVersion

resp, err := cc.AccountAttachments().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down
2 changes: 2 additions & 0 deletions sdm/resource_account_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func resourceAccountGrantCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertAccountGrantFromResourceData(d)

resp, err := cc.AccountGrants().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create AccountGrant: %w", err)
Expand All @@ -68,6 +69,7 @@ func resourceAccountGrantRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertAccountGrantFromResourceData(d)
_ = localVersion

resp, err := cc.AccountGrants().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down
3 changes: 3 additions & 0 deletions sdm/resource_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ func resourceNodeCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertNodeFromResourceData(d)

resp, err := cc.Nodes().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create Node: %w", err)
Expand Down Expand Up @@ -177,6 +178,7 @@ func resourceNodeRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertNodeFromResourceData(d)
_ = localVersion

resp, err := cc.Nodes().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down Expand Up @@ -220,6 +222,7 @@ func resourceNodeRead(d *schema.ResourceData, cc *sdm.Client) error {
func resourceNodeUpdate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutUpdate))
defer cancel()

resp, err := cc.Nodes().Update(ctx, convertNodeFromResourceData(d))
if err != nil {
return fmt.Errorf("cannot update Node %s: %w", d.Id(), err)
Expand Down
3 changes: 3 additions & 0 deletions sdm/resource_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -6462,6 +6462,7 @@ func resourceResourceCreate(d *schema.ResourceData, cc *sdm.Client) error {
if err != nil {
return fmt.Errorf("cannot create Resource: %w", err)
}

resp, err := cc.Resources().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create Resource: %w", err)
Expand Down Expand Up @@ -7414,6 +7415,7 @@ func resourceResourceRead(d *schema.ResourceData, cc *sdm.Client) error {
if err != nil {
return fmt.Errorf("cannot read Resource %s: %w", d.Id(), err)
}

resp, err := cc.Resources().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down Expand Up @@ -8510,6 +8512,7 @@ func resourceResourceUpdate(d *schema.ResourceData, cc *sdm.Client) error {
if err != nil {
return fmt.Errorf("cannot update Resource %s: %w", d.Id(), err)
}

resp, err := cc.Resources().Update(ctx, convertResourceFromResourceData(d))
if err != nil {
return fmt.Errorf("cannot update Resource %s: %w", d.Id(), err)
Expand Down
3 changes: 3 additions & 0 deletions sdm/resource_role.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ func resourceRoleCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertRoleFromResourceData(d)

resp, err := cc.Roles().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create Role: %w", err)
Expand All @@ -79,6 +80,7 @@ func resourceRoleRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertRoleFromResourceData(d)
_ = localVersion

resp, err := cc.Roles().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand All @@ -96,6 +98,7 @@ func resourceRoleRead(d *schema.ResourceData, cc *sdm.Client) error {
func resourceRoleUpdate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutUpdate))
defer cancel()

resp, err := cc.Roles().Update(ctx, convertRoleFromResourceData(d))
if err != nil {
return fmt.Errorf("cannot update Role %s: %w", d.Id(), err)
Expand Down
2 changes: 2 additions & 0 deletions sdm/resource_role_attachment.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func resourceRoleAttachmentCreate(d *schema.ResourceData, cc *sdm.Client) error
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertRoleAttachmentFromResourceData(d)

resp, err := cc.RoleAttachments().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create RoleAttachment: %w", err)
Expand All @@ -68,6 +69,7 @@ func resourceRoleAttachmentRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertRoleAttachmentFromResourceData(d)
_ = localVersion

resp, err := cc.RoleAttachments().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down
2 changes: 2 additions & 0 deletions sdm/resource_role_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ func resourceRoleGrantCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertRoleGrantFromResourceData(d)

resp, err := cc.RoleGrants().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create RoleGrant: %w", err)
Expand All @@ -68,6 +69,7 @@ func resourceRoleGrantRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertRoleGrantFromResourceData(d)
_ = localVersion

resp, err := cc.RoleGrants().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down
67 changes: 67 additions & 0 deletions sdm/resource_secret_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,34 @@ func resourceSecretStore() *schema.Resource {
"tags": {
Type: schema.TypeMap,

Elem: &schema.Schema{
Type: schema.TypeString,
},
Optional: true,
Description: "Tags is a map of key, value pairs.",
},
},
},
},
"aws": {
Type: schema.TypeList,
Optional: true,
Description: "",
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"name": {
Type: schema.TypeString,
Required: true,
Description: "Unique human-readable name of the SecretStore.",
},
"region": {
Type: schema.TypeString,
Required: true,
Description: "",
},
"tags": {
Type: schema.TypeMap,

Elem: &schema.Schema{
Type: schema.TypeString,
},
Expand Down Expand Up @@ -130,13 +158,27 @@ func convertSecretStoreFromResourceData(d *schema.ResourceData) sdm.SecretStore
}
return out
}
if list := d.Get("aws").([]interface{}); len(list) > 0 {
raw, ok := list[0].(map[string]interface{})
if !ok {
return &sdm.AWSStore{}
}
out := &sdm.AWSStore{
ID: d.Id(),
Name: convertStringFromMap(raw, "name"),
Region: convertStringFromMap(raw, "region"),
Tags: convertTagsFromMap(raw, "tags"),
}
return out
}
return nil
}

func resourceSecretStoreCreate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutCreate))
defer cancel()
localVersion := convertSecretStoreFromResourceData(d)

resp, err := cc.SecretStores().Create(ctx, localVersion)
if err != nil {
return fmt.Errorf("cannot create SecretStore: %w", err)
Expand Down Expand Up @@ -166,6 +208,16 @@ func resourceSecretStoreCreate(d *schema.ResourceData, cc *sdm.Client) error {
"tags": convertTagsToMap(v.Tags),
},
})
case *sdm.AWSStore:
localV, _ := localVersion.(*sdm.AWSStore)
_ = localV
d.Set("aws", []map[string]interface{}{
{
"name": (v.Name),
"region": (v.Region),
"tags": convertTagsToMap(v.Tags),
},
})
}
return nil
}
Expand All @@ -175,6 +227,7 @@ func resourceSecretStoreRead(d *schema.ResourceData, cc *sdm.Client) error {
defer cancel()
localVersion := convertSecretStoreFromResourceData(d)
_ = localVersion

resp, err := cc.SecretStores().Get(ctx, d.Id())
var errNotFound *sdm.NotFoundError
if err != nil && errors.As(err, &errNotFound) {
Expand Down Expand Up @@ -213,12 +266,26 @@ func resourceSecretStoreRead(d *schema.ResourceData, cc *sdm.Client) error {
"tags": convertTagsToMap(v.Tags),
},
})
case *sdm.AWSStore:
localV, ok := localVersion.(*sdm.AWSStore)
if !ok {
localV = &sdm.AWSStore{}
}
_ = localV
d.Set("aws", []map[string]interface{}{
{
"name": (v.Name),
"region": (v.Region),
"tags": convertTagsToMap(v.Tags),
},
})
}
return nil
}
func resourceSecretStoreUpdate(d *schema.ResourceData, cc *sdm.Client) error {
ctx, cancel := context.WithTimeout(context.Background(), d.Timeout(schema.TimeoutUpdate))
defer cancel()

resp, err := cc.SecretStores().Update(ctx, convertSecretStoreFromResourceData(d))
if err != nil {
return fmt.Errorf("cannot update SecretStore %s: %w", d.Id(), err)
Expand Down
Loading

0 comments on commit 9f74642

Please sign in to comment.