Skip to content

feat: C.1 - Add Google Cloud Secret Manager support #135

@mpyw

Description

@mpyw

Parent Issue

Part of #128

Summary

Add support for Google Cloud Secret Manager.

Prerequisites

CLI Commands

suve gcloud --project=my-project secret show my-secret
suve gcloud --project=my-project secret log my-secret
suve gcloud --project=my-project secret diff my-secret
suve gcloud --project=my-project secret list

# Staging
suve gcloud --project=my-project stage secret add my-secret
suve gcloud --project=my-project stage status
suve gcloud --project=my-project stage apply

# Alias
suve gcp --project=my-project secret show my-secret

Version Specification

Feature Support
Version format Integer (1, 2, 3...)
#N syntax Yes
~N syntax Yes
:LABEL syntax No (not supported by Google Cloud)
State enabled/disabled/destroyed

Directory Structure

internal/
├── provider/
│   └── gcloud/
│       └── secret/
│           ├── adapter.go
│           └── convert.go
├── version/
│   └── gcloudsecretversion/
│       └── parser.go
└── cli/
    └── commands/
        └── gcloud/
            ├── app.go
            └── secret/
                ├── show.go
                ├── log.go
                ├── diff.go
                └── list.go

Project Resolution

func resolveProject(flag string) (string, error) {
    if flag != "" {
        return flag, nil
    }
    if v := os.Getenv("CLOUDSDK_CORE_PROJECT"); v != "" {
        return v, nil
    }
    if v := os.Getenv("GOOGLE_CLOUD_PROJECT"); v != "" {
        return v, nil
    }
    out, err := exec.Command("gcloud", "config", "get-value", "project").Output()
    if err == nil && len(out) > 0 {
        return strings.TrimSpace(string(out)), nil
    }
    return "", errors.New("--project required")
}

Scope

  • Implement internal/provider/gcloud/secret/ adapter
  • Add version spec parser for Google Cloud
  • Add gcloud command with gcp alias
  • Implement staging support
  • Add E2E tests with emulator

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions