From 7b0276000e9d1b27407e73b98be16a53e73a28b1 Mon Sep 17 00:00:00 2001
From: Samir Faci <samir@es.net>
Date: Wed, 17 Jul 2024 16:10:03 -0500
Subject: [PATCH] Adding IP stack option (stack_type) to gcp_compute_instance

Fixes #618
---
 plugins/modules/gcp_compute_instance.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/plugins/modules/gcp_compute_instance.py b/plugins/modules/gcp_compute_instance.py
index 1d7f56e..9e7d77c 100644
--- a/plugins/modules/gcp_compute_instance.py
+++ b/plugins/modules/gcp_compute_instance.py
@@ -947,6 +947,11 @@ networkInterfaces:
         .
       returned: success
       type: dict
+    stack_type:
+      description:
+      - The IP stack type of the network, possible values: (IPV4_IPV6, IPV4_ONLY)
+      returned: success
+      type: str
     networkIP:
       description:
       - An IPv4 internal network address to assign to the instance for this network
@@ -1164,6 +1169,7 @@ def main():
                     network=dict(type='dict'),
                     network_ip=dict(type='str'),
                     subnetwork=dict(type='dict'),
+                    stack_type=dict(type='str'),
                 ),
             ),
             scheduling=dict(
@@ -1702,6 +1708,7 @@ class InstanceNetworkinterfacesArray(object):
                 u'aliasIpRanges': InstanceAliasiprangesArray(item.get('alias_ip_ranges', []), self.module).to_request(),
                 u'network': replace_resource_dict(item.get(u'network', {}), 'selfLink'),
                 u'networkIP': item.get('network_ip'),
+                u'stackType': item.get('stack_type'),
                 u'subnetwork': replace_resource_dict(item.get(u'subnetwork', {}), 'selfLink'),
             }
         )
@@ -1713,6 +1720,7 @@ class InstanceNetworkinterfacesArray(object):
                 u'aliasIpRanges': InstanceAliasiprangesArray(item.get(u'aliasIpRanges', []), self.module).from_response(),
                 u'network': item.get(u'network'),
                 u'networkIP': item.get(u'networkIP'),
+                u'stackType': item.get('stackType'),
                 u'subnetwork': item.get(u'subnetwork'),
             }
         )