Skip to content

Conversation

AdamBouhmad
Copy link
Contributor

@AdamBouhmad AdamBouhmad commented Oct 16, 2023

Inspired by @grantorchard's scope datasource PR, I put together a first pass for the static cred store. Still needing to write tests & add documentation.

The static cred store datasource currently will allow the discovery of the resource by it's name, and will additionally return back the description of the resource.

data "boundary_credential_store_static" "test" {
  name     = "demo"
  scope_id = "p_jerZbKEwuL"
}

output "boundary_credential_store_id" {
  value = data.boundary_credential_store_static.test.id)
}

output "boundary_credential_store_name" {
  value = data.boundary_credential_store_static.test.name)
}

output "boundary_credential_store_description" {
  value = data.boundary_credential_store_static.test.description
}

----

Apply complete! Resources: 0 added, 0 changed, 0 destroyed.

Outputs:

boundary_credential_store_description = "testing!"
boundary_credential_store_id = "csst_qWsGl3OoHW"
boundary_credential_store_name = "demo"


csl, err := client.List(ctx, scopeId, opts...)
if err != nil {
return diag.Errorf("error calling read static credential store: %v", err)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we're technically listing here instead of reading. I do see that's the message we have for scopes. We may want to modify that one.

Suggested change
return diag.Errorf("error calling read static credential store: %v", err)
return diag.Errorf("error calling list static credential store: %v", err)

Comment on lines +101 to +102
}
func setFromStaticCredentialStoreReadResponseMap(d *schema.ResourceData, raw map[string]interface{}, fromRead bool) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline

Suggested change
}
func setFromStaticCredentialStoreReadResponseMap(d *schema.ResourceData, raw map[string]interface{}, fromRead bool) error {
}
func setFromStaticCredentialStoreReadResponseMap(d *schema.ResourceData, raw map[string]interface{}, fromRead bool) error {

Comment on lines +44 to +45
}
func dataSourceCredentialStoreStaticRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: newline

Suggested change
}
func dataSourceCredentialStoreStaticRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {
}
func dataSourceCredentialStoreStaticRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics {

DataSourcesMap: map[string]*schema.Resource{
"boundary_scope": dataSourceScope(),
"boundary_scope": dataSourceScope(),
"boundary_credential_store_static": dataSourceCredentialStoreStatic(),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I follow how to break down these resources. What's the reason for creating a specific boundary_credential_store_static data source as opposed to a boundary_credential_store one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants