Skip to content

Commit 449bf01

Browse files
authored
⭐ Add new GCP resource for secrets (#6606)
* Add new GCP resource for secrets Expose secrets resource ``` gcp.project.secretmanager.secrets gcp.project.secretmanager.secrets { name labels replication created expireTime } gcp.project.secretmanager.secrets { versions { name state created } } gcp.project.secretmanager.secrets { iamPolicy { role members } } ``` Signed-off-by: Tim Smith <tsmith84@gmail.com> * Fix the encryption fetching Signed-off-by: Tim Smith <tsmith84@gmail.com> * Take 10 on this Signed-off-by: Tim Smith <tsmith84@gmail.com> * Fix type + fix name of createTime Last review items hopefully :) Signed-off-by: Tim Smith <tsmith84@gmail.com> --------- Signed-off-by: Tim Smith <tsmith84@gmail.com>
1 parent f12ab76 commit 449bf01

File tree

7 files changed

+1255
-1
lines changed

7 files changed

+1255
-1
lines changed

.github/actions/spelling/expect.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ sbom
146146
scim
147147
scm
148148
SECRETID
149+
secretmanager
149150
SECRETVALUE
150151
serviceprincipals
151152
Sflags

providers/gcp/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ require (
1919
cloud.google.com/go/recommender v1.13.6
2020
cloud.google.com/go/redis v1.18.3
2121
cloud.google.com/go/run v1.15.0
22+
cloud.google.com/go/secretmanager v1.16.0
2223
cloud.google.com/go/serviceusage v1.9.7
2324
github.com/aws/smithy-go v1.24.0
2425
github.com/cockroachdb/errors v1.12.0
@@ -129,7 +130,6 @@ require (
129130
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
130131
cloud.google.com/go/binaryauthorization v1.10.0
131132
cloud.google.com/go/compute/metadata v0.9.0 // indirect
132-
cloud.google.com/go/secretmanager v1.16.0 // indirect
133133
cloud.google.com/go/storage v1.59.0 // indirect
134134
dario.cat/mergo v1.0.2 // indirect
135135
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect

providers/gcp/resources/gcp.lr

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,8 @@ gcp.project @defaults("name") {
437437
binaryAuthorization() gcp.project.binaryAuthorizationControl
438438
// GCP Redis resources
439439
redis() gcp.project.redisService
440+
// GCP Secret Manager resources
441+
secretmanager() gcp.project.secretmanagerService
440442
}
441443

442444
// Google Cloud (GCP) service
@@ -3253,3 +3255,69 @@ private gcp.project.binaryAuthorizationControl.admissionRule {
32533255
// The resource names of the attestors that must attest to a container image
32543256
requireAttestationsBy []string
32553257
}
3258+
3259+
// Google Cloud (GCP) Secret Manager
3260+
private gcp.project.secretmanagerService {
3261+
// Project ID
3262+
projectId string
3263+
// List of secrets in the current project
3264+
secrets() []gcp.project.secretmanagerService.secret
3265+
}
3266+
3267+
// Google Cloud (GCP) Secret Manager secret
3268+
private gcp.project.secretmanagerService.secret @defaults("name createTime") {
3269+
// Project ID
3270+
projectId string
3271+
// Full resource path (projects/*/secrets/*)
3272+
resourcePath string
3273+
// Secret name
3274+
name string
3275+
// Time the secret was created
3276+
createTime time
3277+
// User-assigned labels
3278+
labels map[string]string
3279+
// Replication policy configuration
3280+
replication dict
3281+
// Pub/Sub topics for event notifications
3282+
topics []string
3283+
// Expiration time (if set)
3284+
expireTime time
3285+
// Etag of the secret
3286+
etag string
3287+
// Rotation policy configuration
3288+
rotation dict
3289+
// Version aliases mapping alias names to version numbers
3290+
versionAliases map[string]int
3291+
// Custom metadata annotations
3292+
annotations map[string]string
3293+
// Version destroy TTL duration
3294+
versionDestroyTtl time
3295+
// Customer-managed encryption key names from all replication locations
3296+
customerManagedEncryption []string
3297+
// List of secret versions
3298+
versions() []gcp.project.secretmanagerService.secret.version
3299+
// IAM policy for this secret
3300+
iamPolicy() []gcp.resourcemanager.binding
3301+
}
3302+
3303+
// Google Cloud (GCP) Secret Manager secret version
3304+
private gcp.project.secretmanagerService.secret.version @defaults("name state") {
3305+
// Full resource path (projects/*/secrets/*/versions/*)
3306+
resourcePath string
3307+
// Version number
3308+
name string
3309+
// Current state (ENABLED, DISABLED, DESTROYED)
3310+
state string
3311+
// Time the version was created
3312+
created time
3313+
// Time the version was destroyed
3314+
destroyed time
3315+
// Etag of the version
3316+
etag string
3317+
// Whether the client specified a payload checksum
3318+
clientSpecifiedPayloadChecksum bool
3319+
// Scheduled destroy time (for delayed destruction)
3320+
scheduledDestroyTime time
3321+
// Customer-managed encryption status
3322+
customerManagedEncryption dict
3323+
}

0 commit comments

Comments
 (0)