Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dry-run wif config delete before tearing down cloud resources #670

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/ocm/gcp/delete-wif-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,13 @@ func deleteWorkloadIdentityConfigurationCmd(cmd *cobra.Command, argv []string) e
return errors.Wrapf(err, "failed to get wif-config")
}

// Check if wif-config can be deleted with dry-run
_, err = connection.ClustersMgmt().V1().GCP().WifConfigs().
WifConfig(wifConfig.ID()).Delete().DryRun(true).Send()
if err != nil {
return errors.Wrapf(err, "failed to delete wif config %q", wifConfig.ID())
}

if DeleteWifConfigOpts.DryRun {
log.Printf("Writing script files to %s", DeleteWifConfigOpts.TargetDir)

Expand Down
2 changes: 1 addition & 1 deletion cmd/ocm/gcp/list-wif-config.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewListWorkloadIdentityConfiguration() *cobra.Command {
fs.StringVar(
&ListWorkloadIdentityConfigurationOpts.columns,
"columns",
"id, display_name",
"id, display_name, gcp.project_id",
"Specify which columns to display separated by commas, path is based on wif-config struct",
)
fs.BoolVar(
Expand Down
2 changes: 2 additions & 0 deletions pkg/output/tables/wifconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ columns:
header: ID
- name: displayName
header: NAME
- name: gcp.project_id
header: PROJECT ID
Loading