diff --git a/lib/modules/manager/terraform/lockfile/index.spec.ts b/lib/modules/manager/terraform/lockfile/index.spec.ts
index 93cb54e62069d732f2f979f9b0fc9121ba9fa675..fb1eb92b9f3e2b494177d5969721d27e1ee1229b 100644
--- a/lib/modules/manager/terraform/lockfile/index.spec.ts
+++ b/lib/modules/manager/terraform/lockfile/index.spec.ts
@@ -1104,5 +1104,18 @@ describe('modules/manager/terraform/lockfile/index', () => {
         ),
       ).toBe('5.26.0');
     });
+
+    it('update constraint with multiple elements', () => {
+      expect(
+        getNewConstraint(
+          {
+            currentValue: '2.41.0',
+            newValue: '2.46.0',
+            newVersion: '2.46.0',
+          },
+          '>= 2.36.0, 2.41.0',
+        ),
+      ).toBe('>= 2.36.0, 2.46.0');
+    });
   });
 });
diff --git a/lib/modules/manager/terraform/lockfile/index.ts b/lib/modules/manager/terraform/lockfile/index.ts
index f73ca9d9a3bd2d38b83c15033bf7483aa4c1b6a1..53c6ae7e3388a5296c5a89290de0bc6296d10045 100644
--- a/lib/modules/manager/terraform/lockfile/index.ts
+++ b/lib/modules/manager/terraform/lockfile/index.ts
@@ -1,6 +1,7 @@
 import is from '@sindresorhus/is';
 import { logger } from '../../../../logger';
 import * as p from '../../../../util/promises';
+import { escapeRegExp, regEx } from '../../../../util/regex';
 import { GetPkgReleasesConfig, getPkgReleases } from '../../../datasource';
 import { TerraformProviderDatasource } from '../../../datasource/terraform-provider';
 import { get as getVersioning } from '../../../versioning';
@@ -88,12 +89,11 @@ export function getNewConstraint(
     logger.debug(
       `Updating constraint "${oldConstraint}" to replace "${currentValue}" with "${newValue}" for "${packageName}"`,
     );
-    let newConstraint = oldConstraint.replace(currentValue, newValue);
     //remove surplus .0 version
-    while (newConstraint.split('.').length - 1 > 2) {
-      newConstraint = newConstraint.replace(RegExp('\\.0$'), '');
-    }
-    return newConstraint;
+    return oldConstraint.replace(
+      regEx(`${escapeRegExp(currentValue)}(\\.0)*`),
+      newValue,
+    );
   }
 
   if (