Skip to content

Commit

Permalink
Dry-run wif config delete before tearing down cloud resources (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
JakobGray authored Oct 2, 2024
1 parent e4aa770 commit cf6e500
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit cf6e500

Please sign in to comment.