@@ -69,11 +69,7 @@ func (r *clusterResource) Create(ctx context.Context, req resource.CreateRequest
6969 resp .Diagnostics .AddError ("Client Error" , fmt .Sprintf ("Unable to create cluster, got error: %s" , err ))
7070 return
7171 }
72-
7372 data .FromCreate (result , ctx , & resp .Diagnostics )
74- if resp .Diagnostics .HasError () {
75- return
76- }
7773
7874 if r .kubeClient != nil || data .HasKubeconfig () {
7975 err = InstallOrUpgradeAgent (ctx , r .client , data .GetKubeconfig (), r .kubeClient , data .HelmRepoUrl .ValueString (),
@@ -83,7 +79,7 @@ func (r *clusterResource) Create(ctx context.Context, req resource.CreateRequest
8379 resp .Diagnostics .AddWarning ("Agent Installation Failed" , fmt .Sprintf (
8480 "Unable to install agent, in order to retry run `terraform apply` again. Got error: %s" , err ))
8581 } else {
86- data .AgentDeployed = types .BoolValue (false ) // TODO: Test change, set to true.
82+ data .AgentDeployed = types .BoolValue (true )
8783 }
8884 }
8985
@@ -145,9 +141,8 @@ func (r *clusterResource) Update(ctx context.Context, req resource.UpdateRequest
145141 return
146142 }
147143
148- needsAgentReinstall := ! data .AgentDeployed .ValueBool ()
149144 kubeconfigChanged := data .HasKubeconfig () && ! data .GetKubeconfig ().Unchanged (state .GetKubeconfig ())
150- reinstallable := ! data .HelmRepoUrl .Equal (state .HelmRepoUrl ) || kubeconfigChanged || needsAgentReinstall
145+ reinstallable := ! data .AgentDeployed . ValueBool () || ! data . HelmRepoUrl .Equal (state .HelmRepoUrl ) || kubeconfigChanged
151146 if reinstallable && (r .kubeClient != nil || data .HasKubeconfig ()) {
152147 clusterWithToken , err := r .client .GetClusterWithToken (ctx , data .Id .ValueStringPointer (), nil )
153148 if err != nil {
@@ -162,7 +157,6 @@ func (r *clusterResource) Update(ctx context.Context, req resource.UpdateRequest
162157 }
163158
164159 data .AgentDeployed = types .BoolValue (true )
165-
166160 }
167161
168162 resp .Diagnostics .Append (resp .State .Set (ctx , & data )... )
0 commit comments