File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ class GcpConfig:
196196 # Network settings
197197 network : str = "default"
198198 subnet : str = ""
199+ private_ip : str = "" # static internal IP to bind (--private-network-ip)
199200
200201 # Identity settings
201202 service_account : str = ""
@@ -236,6 +237,7 @@ class GcpConfig:
236237 "bucket" : "" ,
237238 "network" : "default" ,
238239 "subnet" : "" ,
240+ "private_ip" : "" ,
239241 "service_account" : "" ,
240242 "scopes" : [],
241243 "tags" : [],
@@ -1408,6 +1410,13 @@ class CloudDeploymentManager:
14081410 create_args .append (f"--network={ config .network } " )
14091411 if config .subnet :
14101412 create_args .append (f"--subnet={ config .subnet } " )
1413+ if config .private_ip :
1414+ # Bind a reserved static internal IP so the VM keeps the same RFC1918
1415+ # address across remove/deploy. --private-network-ip needs the subnet
1416+ # named, so default it when the user didn't set one.
1417+ if not config .subnet :
1418+ create_args .append ("--subnet=default" )
1419+ create_args .append (f"--private-network-ip={ config .private_ip } " )
14111420 if config .service_account :
14121421 create_args .append (f"--service-account={ config .service_account } " )
14131422 if config .scopes :
You can’t perform that action at this time.
0 commit comments