Skip to content

Commit

Permalink
fix the flattening of the fields in the google_secret_manager_secrets…
Browse files Browse the repository at this point in the history
… datasource
  • Loading branch information
abheda-crest committed Oct 3, 2024
1 parent 1347042 commit f2dbe25
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,21 @@ func flattenSecretManagerSecretsSecrets(v interface{}, d *schema.ResourceData, c
continue
}
transformed = append(transformed, map[string]interface{}{
"replication": flattenSecretManagerSecretReplication(original["replication"], d, config),
"annotations": flattenSecretManagerSecretAnnotations(original["annotations"], d, config),
"expire_time": flattenSecretManagerSecretExpireTime(original["expireTime"], d, config),
"labels": flattenSecretManagerSecretLabels(original["labels"], d, config),
"rotation": flattenSecretManagerSecretRotation(original["rotation"], d, config),
"topics": flattenSecretManagerSecretTopics(original["topics"], d, config),
"version_aliases": flattenSecretManagerSecretVersionAliases(original["versionAliases"], d, config),
"create_time": flattenSecretManagerSecretCreateTime(original["createTime"], d, config),
"name": flattenSecretManagerSecretName(original["name"], d, config),
"project": getDataFromName(original["name"], 1),
"secret_id": getDataFromName(original["name"], 3),
"replication": flattenSecretManagerSecretReplication(original["replication"], d, config),
"annotations": flattenSecretManagerSecretEffectiveAnnotations(original["annotations"], d, config),
"effective_annotations": flattenSecretManagerSecretEffectiveAnnotations(original["annotations"], d, config),
"expire_time": flattenSecretManagerSecretExpireTime(original["expireTime"], d, config),
"labels": flattenSecretManagerSecretEffectiveLabels(original["labels"], d, config),
"effective_labels": flattenSecretManagerSecretEffectiveLabels(original["labels"], d, config),
"terraform_labels": flattenSecretManagerSecretEffectiveLabels(original["labels"], d, config),
"rotation": flattenSecretManagerSecretRotation(original["rotation"], d, config),
"topics": flattenSecretManagerSecretTopics(original["topics"], d, config),
"version_aliases": flattenSecretManagerSecretVersionAliases(original["versionAliases"], d, config),
"version_destroy_ttl": flattenSecretManagerSecretVersionDestroyTtl(original["versionDestroyTtl"], d, config),
"create_time": flattenSecretManagerSecretCreateTime(original["createTime"], d, config),
"name": flattenSecretManagerSecretName(original["name"], d, config),
"project": getDataFromName(original["name"], 1),
"secret_id": getDataFromName(original["name"], 3),
})
}
return transformed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ func TestAccDataSourceSecretManagerSecrets_basic(t *testing.T) {
"data.google_secret_manager_secrets.foo",
"google_secret_manager_secret.foo",
map[string]struct{}{
"id": {},
"project": {},
"effective_labels": {},
"labels": {},
"terraform_labels": {},
"id": {},
"project": {},
},
),
),
Expand All @@ -59,6 +56,16 @@ resource "google_secret_manager_secret" "foo" {
}
}
}
labels = {
label = "my-label"
}
annotations = {
key1 = "value1"
}
version_destroy_ttl = "360000s"
}
data "google_secret_manager_secrets" "foo" {
Expand Down Expand Up @@ -89,11 +96,8 @@ func TestAccDataSourceSecretManagerSecrets_filter(t *testing.T) {
"google_secret_manager_secret.foo",
"google_secret_manager_secret.bar",
map[string]struct{}{
"id": {},
"project": {},
"effective_labels": {},
"labels": {},
"terraform_labels": {},
"id": {},
"project": {},
},
),
),
Expand All @@ -118,6 +122,14 @@ resource "google_secret_manager_secret" "foo" {
}
}
}
labels = {
label = "my-label"
}
annotations = {
key1 = "value1"
}
}
resource "google_secret_manager_secret" "bar" {
Expand All @@ -130,6 +142,14 @@ resource "google_secret_manager_secret" "bar" {
}
}
}
labels = {
label= "my-label2"
}
annotations = {
key1 = "value1"
}
}
data "google_secret_manager_secrets" "foo" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ exported:

* `version_aliases` - Mapping from version alias to version name.

* `version_destroy_ttl` - The version destroy ttl for the secret version.

* `topics` -
A list of up to 10 Pub/Sub topics to which messages are published when control plane operations are called on the secret or its versions.
Structure is [documented below](#nested_topics).
Expand Down

0 comments on commit f2dbe25

Please sign in to comment.