This repository was archived by the owner on Nov 20, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,16 @@ func main() {
3737 flag .BoolVar (& enableLeaderElection , "enable-leader-election" , false ,
3838 "Enable leader election for controller manager. " +
3939 "Enabling this will ensure there is only one active controller manager." )
40+ opts := zap.Options {}
41+ opts .BindFlags (flag .CommandLine )
42+ err := flag .Set ("zap-devel" , "true" )
43+ if err != nil {
44+ setupLog .Error (err , "unable to set zap flag" )
45+ }
46+
4047 flag .Parse ()
4148
42- ctrl .SetLogger (zap .New (zap .UseDevMode ( true )))
49+ ctrl .SetLogger (zap .New (zap .UseFlagOptions ( & opts )))
4350
4451 mgr , err := ctrl .NewManager (ctrl .GetConfigOrDie (), ctrl.Options {
4552 Namespace : namespaceName ,
Original file line number Diff line number Diff line change @@ -167,9 +167,12 @@ func (t *TerraformCloudClient) updateAgentPoolID(instance *appv1alpha1.Workspace
167167func (t * TerraformCloudClient ) CheckWorkspace (workspace string , instance * appv1alpha1.Workspace ) (* tfc.Workspace , error ) {
168168 ws , err := t .Client .Workspaces .Read (context .TODO (), t .Organization , workspace )
169169 if err != nil && err == tfc .ErrResourceNotFound {
170- id , err := t .CreateWorkspace (workspace , instance )
171- if err != nil {
172- return nil , err
170+ id , wsErr := t .CreateWorkspace (workspace , instance )
171+ if wsErr != nil {
172+ return nil , wsErr
173+ } else {
174+ ws = & tfc.Workspace {ID : id }
175+ err = nil
173176 }
174177 ws = & tfc.Workspace {ID : id }
175178 } else if err != nil {
You can’t perform that action at this time.
0 commit comments