diff --git a/routers/api/packages/terraform/terraform.go b/routers/api/packages/terraform/terraform.go index f0948fbbd8..e213d76ef1 100644 --- a/routers/api/packages/terraform/terraform.go +++ b/routers/api/packages/terraform/terraform.go @@ -331,11 +331,6 @@ func UnlockState(ctx *context.Context) { _ = json.Unmarshal(body, &unlockRequest) // The error can be ignored, since the ID can also be in the query } - // If the ID is not found in the body, look in the query parameters - if unlockRequest.ID == "" { - unlockRequest.ID = ctx.Query("ID").(string) - } - // Check for ID presence if unlockRequest.ID == "" { log.Error("Missing lock ID in both query and request body") diff --git a/templates/package/content/terraform.tmpl b/templates/package/content/terraform.tmpl index 8d6ddd57d2..c59713c0db 100644 --- a/templates/package/content/terraform.tmpl +++ b/templates/package/content/terraform.tmpl @@ -8,14 +8,14 @@ export GITEA_USER_PASSWORD=<YOUR-USER-PASSWORD> export TF_STATE_NAME=your-state.tfstate terraform init \ - -backend-config="address= \ - -backend-config="lock_address= \ - -backend-config="unlock_address= \ - -backend-config="username={{.PackageDescriptor.Owner.Name}}" \ - -backend-config="password=$GITEA_USER_PASSWORD" \ - -backend-config="lock_method=POST" \ - -backend-config="unlock_method=DELETE" \ - -backend-config="retry_wait_min=5" + -backend-config="address= \ + -backend-config="lock_address= \ + -backend-config="unlock_address= \ + -backend-config="username={{.PackageDescriptor.Owner.Name}}" \ + -backend-config="password=$GITEA_USER_PASSWORD" \ + -backend-config="lock_method=POST" \ + -backend-config="unlock_method=DELETE" \ + -backend-config="retry_wait_min=5"