Skip to content

Commit

Permalink
Adjust DBaaS VPC pointer to detect changes
Browse files Browse the repository at this point in the history
  • Loading branch information
christhemorse committed Oct 24, 2023
1 parent ab18ce0 commit 1937265
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@ var databaseUpdate = &cobra.Command{
label, _ := cmd.Flags().GetString("label")
tag, _ := cmd.Flags().GetString("tag")
vpc, _ := cmd.Flags().GetString("vpc-id")
vpcSet := cmd.Flags().Lookup("vpc-id").Changed
maintenanceDOW, _ := cmd.Flags().GetString("maintenance-dow")
maintenanceTime, _ := cmd.Flags().GetString("maintenance-time")
clusterTimeZone, _ := cmd.Flags().GetString("cluster-time-zone")
Expand All @@ -527,7 +528,6 @@ var databaseUpdate = &cobra.Command{
Plan: plan,
Label: label,
Tag: tag,
VPCID: govultr.StringToStringPtr(vpc),
MaintenanceDOW: maintenanceDOW,
MaintenanceTime: maintenanceTime,
ClusterTimeZone: clusterTimeZone,
Expand All @@ -537,6 +537,10 @@ var databaseUpdate = &cobra.Command{
RedisEvictionPolicy: redisEvictionPolicy,
}

if vpcSet {
opt.VPCID = govultr.StringToStringPtr(vpc)
}

if mysqlRequirePrimaryKeySet && mysqlRequirePrimaryKey {
opt.MySQLRequirePrimaryKey = govultr.BoolToBoolPtr(true)
} else if mysqlRequirePrimaryKeySet && !mysqlRequirePrimaryKey {
Expand Down

0 comments on commit 1937265

Please sign in to comment.