From 782c0b35eb5cc401997ac39138d2a5cf5ccf4cf6 Mon Sep 17 00:00:00 2001
From: Enrico Falco <enrico9034@gmail.com>
Date: Mon, 9 Dec 2024 16:50:02 +0100
Subject: [PATCH] Support python 3.12 for terraform.py in regex expression
 (#11773)

---
 contrib/terraform/terraform.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/contrib/terraform/terraform.py b/contrib/terraform/terraform.py
index f8487bf6b..c22eb9f41 100755
--- a/contrib/terraform/terraform.py
+++ b/contrib/terraform/terraform.py
@@ -98,7 +98,7 @@ PARSERS = {}
 def _clean_dc(dcname):
     # Consul DCs are strictly alphanumeric with underscores and hyphens -
     # ensure that the consul_dc attribute meets these requirements.
-    return re.sub('[^\w_\-]', '-', dcname)
+    return re.sub(r'[^\w_\-]', '-', dcname)
 
 
 def iterhosts(resources):
@@ -304,7 +304,7 @@ def openstack_host(resource, module_name):
     try:
         if 'metadata.prefer_ipv6' in raw_attrs and raw_attrs['metadata.prefer_ipv6'] == "1":
             attrs.update({
-                'ansible_host': re.sub("[\[\]]", "", raw_attrs['access_ip_v6']),
+                'ansible_host': re.sub(r"[\[\]]", "", raw_attrs['access_ip_v6']),
                 'publicly_routable': True,
             })
         else:
-- 
GitLab