Skip to content

Commit 66550ac

Browse files
committed
Remove Update logic from tfe_registry_gpg_key
1 parent dfab5d7 commit 66550ac

File tree

1 file changed

+5
-34
lines changed

1 file changed

+5
-34
lines changed

internal/provider/resource_tfe_registry_gpg_key.go

Lines changed: 5 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -177,40 +177,11 @@ func (r *resourceTFERegistryGPGKey) Read(ctx context.Context, req resource.ReadR
177177
}
178178

179179
func (r *resourceTFERegistryGPGKey) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) {
180-
var plan modelTFERegistryGPGKey
181-
var state modelTFERegistryGPGKey
182-
183-
// Read Terraform plan data into the model
184-
resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
185-
186-
// Read Terraform prior state data into the model
187-
resp.Diagnostics.Append(req.State.Get(ctx, &state)...)
188-
189-
if resp.Diagnostics.HasError() {
190-
return
191-
}
192-
193-
keyID := tfe.GPGKeyID{
194-
RegistryName: "private",
195-
Namespace: state.Organization.ValueString(), // The old namespace
196-
KeyID: plan.ID.ValueString(),
197-
}
198-
options := tfe.GPGKeyUpdateOptions{
199-
Type: "gpg-keys",
200-
Namespace: plan.Organization.ValueString(), // The new namespace
201-
}
202-
203-
tflog.Debug(ctx, "Updating private registry GPG key")
204-
key, err := r.config.Client.GPGKeys.Update(ctx, keyID, options)
205-
if err != nil {
206-
resp.Diagnostics.AddError("Unable to update private registry GPG key", err.Error())
207-
return
208-
}
209-
210-
result := modelFromTFEVGPGKey(key)
211-
212-
// Save updated data into Terraform state
213-
resp.Diagnostics.Append(resp.State.Set(ctx, &result)...)
180+
// If the resource does not support modification and should always be recreated on
181+
// configuration value updates, the Update logic can be left empty and ensure all
182+
// configurable schema attributes implement the resource.RequiresReplace()
183+
// attribute plan modifier.
184+
resp.Diagnostics.AddError("Update not supported", "The update operation is not supported on this resource. This is a bug in the provider.")
214185
}
215186

216187
func (r *resourceTFERegistryGPGKey) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse) {

0 commit comments

Comments
 (0)