Skip to content

Commit c5b07f5

Browse files
twarnockMark Beacom
authored andcommitted
add in support for custom subnet and security groups (#91)
1 parent 6889972 commit c5b07f5

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

cloudendure/cloudendure.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def __init__(
7070
self.destination_role: str = self.config.active_config.get(
7171
"destination_role", ""
7272
)
73+
self.subnet_id: str = self.config.active_config.get("subnet_id", "")
74+
self.security_group_id: str = self.config.active_config.get(
75+
"security_group_id", ""
76+
)
7377
self.target_machines: List[str] = self.config.active_config.get(
7478
"machines", ""
7579
).split(",")
@@ -487,6 +491,10 @@ def update_blueprint(self) -> bool:
487491
)
488492
blueprint["disks"] = new_disks
489493

494+
# Update launch subnets and SG IDs
495+
blueprint["subnetIDs"] = [self.subnet_id]
496+
blueprint["securityGroupIDs"] = [self.security_group_id]
497+
490498
# Update machine tags
491499
blueprint["tags"] = [
492500
{
@@ -517,6 +525,7 @@ def update_blueprint(self) -> bool:
517525
"Blueprint update failure encountered for machine:",
518526
f"({_machine_name}) - {result.status_code} fix blueprint settings!",
519527
)
528+
print(blueprint)
520529
else:
521530
print("Blueprint for machine: " + _machine_name + " updated!")
522531
except Exception as e:

cloudendure/config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ class CloudEndureConfig:
3535
"destination_account": "",
3636
"destination_kms": "",
3737
"destination_role": "",
38+
"subnet_id": "",
39+
"security_group_id": "",
3840
"disk_type": "SSD",
3941
"public_ip": "DONT_ALLOCATE",
4042
}

0 commit comments

Comments
 (0)