Skip to content

Commit 4d3e497

Browse files
committed
Address PR feedback and add missing field
1 parent c5478cc commit 4d3e497

File tree

5 files changed

+30
-19
lines changed

5 files changed

+30
-19
lines changed

docs/resources/vault_secrets_app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ resource "hcp_vault_secrets_app" "example" {
2929

3030
- `description` (String) The Vault Secrets app description
3131
- `project_id` (String) The ID of the HCP project where the HCP Vault Secrets app is located.
32-
- `sync_names` (List of String) List of sync names to associate with this app.
32+
- `sync_names` (Set of String) Set of sync names to associate with this app.
3333

3434
### Read-Only
3535

docs/resources/vault_secrets_sync.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,12 @@ resource "hcp_vault_secrets_sync" "example_aws_sync" {
4242

4343
Required:
4444

45-
- `project_id` (String, Sensitive)
46-
- `scope` (String)
45+
- `scope` (String) The scope to which values apply. The valid options are GROUP and PROJECT
46+
47+
Optional:
48+
49+
- `group_id` (String, Sensitive) ID of the group, if the scope is GROUP
50+
- `project_id` (String, Sensitive) ID of the project, if the scope is PROJECT
4751

4852
## Import
4953

internal/provider/vaultsecrets/resource_vault_secrets_app.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ import (
1010

1111
"github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/stable/2023-11-28/client/secret_service"
1212
secretmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-vault-secrets/stable/2023-11-28/models"
13-
"github.com/hashicorp/terraform-plugin-framework-validators/listvalidator"
13+
"github.com/hashicorp/terraform-plugin-framework-validators/setvalidator"
1414
"github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
1515
"github.com/hashicorp/terraform-plugin-framework/diag"
1616
"github.com/hashicorp/terraform-plugin-framework/path"
1717
"github.com/hashicorp/terraform-plugin-framework/resource"
1818
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
19-
"github.com/hashicorp/terraform-plugin-framework/resource/schema/listplanmodifier"
2019
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
20+
"github.com/hashicorp/terraform-plugin-framework/resource/schema/setplanmodifier"
2121
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
2222
"github.com/hashicorp/terraform-plugin-framework/schema/validator"
2323
"github.com/hashicorp/terraform-plugin-framework/types"
@@ -93,15 +93,17 @@ func (r *resourceVaultSecretsApp) Schema(_ context.Context, _ resource.SchemaReq
9393
Computed: true,
9494
Description: "The app's resource name in the format secrets/project/<project ID>/app/<app Name>.",
9595
},
96-
"sync_names": schema.ListAttribute{
97-
Description: "List of sync names to associate with this app.",
96+
"sync_names": schema.SetAttribute{
97+
Description: "Set of sync names to associate with this app.",
9898
Optional: true,
9999
ElementType: types.StringType,
100-
PlanModifiers: []planmodifier.List{
101-
listplanmodifier.RequiresReplace(),
100+
PlanModifiers: []planmodifier.Set{
101+
setplanmodifier.RequiresReplace(),
102102
},
103-
Validators: []validator.List{
104-
listvalidator.UniqueValues(),
103+
Validators: []validator.Set{
104+
setvalidator.ValueStringsAre(
105+
stringvalidator.LengthBetween(1, 511),
106+
),
105107
},
106108
}},
107109
}

internal/provider/vaultsecrets/resource_vault_secrets_sync.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,18 @@ func (r *resourceVaultSecretsSync) Schema(_ context.Context, _ resource.SchemaRe
134134
Optional: true,
135135
Attributes: map[string]schema.Attribute{
136136
"scope": schema.StringAttribute{
137-
Description: "", // TODO: write this description
137+
Description: "The scope to which values apply. The valid options are GROUP and PROJECT",
138138
Required: true,
139139
},
140+
"group_id": schema.StringAttribute{
141+
Description: "ID of the group, if the scope is GROUP",
142+
Sensitive: true,
143+
Optional: true,
144+
},
140145
"project_id": schema.StringAttribute{
141-
Description: "", // TODO: write this description
142-
Required: true,
146+
Description: "ID of the project, if the scope is PROJECT",
143147
Sensitive: true,
148+
Optional: true,
144149
},
145150
},
146151
Validators: []validator.Object{

internal/provider/vaultsecrets/resource_vault_secrets_sync_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,18 @@ func TestAccVaultSecretsResourceSync(t *testing.T) {
2121
Check: resource.ComposeTestCheckFunc(
2222
resource.TestCheckResourceAttrSet("hcp_vault_secrets_integration.acc_test", "organization_id"),
2323
resource.TestCheckResourceAttr("hcp_vault_secrets_integration.acc_test", "project_id", os.Getenv("HCP_PROJECT_ID")),
24-
resource.TestCheckResourceAttr("hcp_vault_secrets_sync.acc_test_aws", "name", syncName),
25-
resource.TestCheckResourceAttr("hcp_vault_secrets_sync.acc_test_aws", "integration_name", integrationName),
26-
resource.TestCheckResourceAttrSet("hcp_vault_secrets_sync.acc_test_aws", "organization_id"),
27-
resource.TestCheckResourceAttrSet("hcp_vault_secrets_sync.acc_test_aws", "project_id")),
24+
resource.TestCheckResourceAttr("hcp_vault_secrets_syhcp_vault_secrets_syncnc.acc_test_gitlab", "name", syncName),
25+
resource.TestCheckResourceAttr("hcp_vault_secrets_sync.acc_test_gitlab", "integration_name", integrationName),
26+
resource.TestCheckResourceAttrSet("hcp_vault_secrets_sync.acc_test_gitlab", "organization_id"),
27+
resource.TestCheckResourceAttrSet("hcp_vault_secrets_sync.acc_test_gitlab", "project_id")),
2828
},
2929
},
3030
})
3131
}
3232

3333
func syncConfig(syncName, integrationName string) string {
3434
return fmt.Sprintf(`
35-
resource "hcp_vault_secrets_sync" "acc_test_aws" {
35+
resource "hcp_vault_secrets_sync" "acc_test_gitlab" {
3636
name = %q
3737
integration_name = %q
3838
}`, syncName, integrationName)

0 commit comments

Comments
 (0)