Skip to content

Commit 9c45206

Browse files
committed
2 parents d3deb7c + 76e0fb8 commit 9c45206

File tree

17 files changed

+1163
-290
lines changed

17 files changed

+1163
-290
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.

dags/create_resources.py

Lines changed: 623 additions & 0 deletions
Large diffs are not rendered by default.

dags/idp.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,16 @@ def generate_main_tf(project_id):
286286
address_prefixes = ["10.0.1.0/24"]
287287
}}
288288
289+
# Public IP Addresses
290+
resource "azurerm_public_ip" "vm_public_ip" {{
291+
for_each = {{ for vm in var.vm_resources : vm.name => vm }}
292+
293+
name = "${{each.value.name}}-public-ip"
294+
location = azurerm_resource_group.project_rg.location
295+
resource_group_name = azurerm_resource_group.project_rg.name
296+
allocation_method = "Dynamic"
297+
}}
298+
289299
# Network Interfaces
290300
resource "azurerm_network_interface" "vm_nic" {{
291301
for_each = {{ for vm in var.vm_resources : vm.name => vm }}
@@ -298,9 +308,12 @@ def generate_main_tf(project_id):
298308
name = "internal"
299309
subnet_id = azurerm_subnet.project_subnet.id
300310
private_ip_address_allocation = "Dynamic"
311+
public_ip_address_id = azurerm_public_ip.vm_public_ip[each.key].id
301312
}}
302313
}}
303314
315+
316+
304317
# Virtual Machines
305318
resource "azurerm_virtual_machine" "vm" {{
306319
for_each = {{ for vm in var.vm_resources : vm.name => vm }}
@@ -494,7 +507,7 @@ def generate_variables_tf(project_id):
494507
"ARM_CLIENT_SECRET": os.getenv("AZURE_CLIENT_SECRET"),
495508
"ARM_TENANT_ID": os.getenv("AZURE_TENANT_ID"),
496509
},
497-
retries=3,
510+
retries=3,
498511
retry_delay=timedelta(minutes=5),
499512
)
500513

models/resource.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const resourceSchema = new Schema({
1414
username: { type: String },
1515
password: { type: String },
1616
allocationip: { type: String },
17+
// publicipenabled: { type: Boolean },
1718
projectid: { type: String },
1819
});
1920

package-lock.json

Lines changed: 18 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@azure/arm-compute": "^22.3.0",
14+
"@azure/arm-network": "^33.5.0",
1415
"@azure/arm-resources": "^5.2.0",
1516
"@azure/identity": "^4.7.0",
1617
"@clerk/nextjs": "^6.12.0",

src/app/api/connect-vm/route.js

Lines changed: 0 additions & 81 deletions
This file was deleted.

src/app/cloudresources/page.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default function CloudResources({ params }) {
1717
const [adminPassword, setAdminPassword] = useState("");
1818
const [vmSize, setVMSize] = useState("");
1919
const [allocation, setAllocation] = useState("");
20+
// const [publicIpEnabled, setPublicIpEnabled] = useState(true);
2021
const [alert, setAlert] = useState("");
2122
const [availableVM, setAvailableVM] = useState([]);
2223
const [warning, setWarning] = useState("");
@@ -378,6 +379,7 @@ export default function CloudResources({ params }) {
378379
adminPassword,
379380
vmSize,
380381
allocation,
382+
// publicIpEnabled,
381383
projectID,
382384
}),
383385
});
@@ -688,7 +690,7 @@ export default function CloudResources({ params }) {
688690
</div>
689691

690692
{/* Admin Password */}
691-
<div className="mt-4">
693+
<div>
692694
<label htmlFor="adminPassword" className="font-medium block mb-2">
693695
Admin Password
694696
</label>
@@ -737,6 +739,23 @@ export default function CloudResources({ params }) {
737739
<option value="Static">Static</option>
738740
</select>
739741
</div>
742+
743+
{/* Public IP Configuration */}
744+
{/* <div>
745+
<label htmlFor="publicIpEnabled" className="font-medium block mb-2">
746+
Public IP Address
747+
</label>
748+
<select
749+
id="publicIpEnabled"
750+
name="publicIpEnabled"
751+
className="border border-slate-300 rounded w-full px-4 py-2 text-base"
752+
onChange={(e) => setPublicIpEnabled(e.target.value === "true")}
753+
>
754+
<option value="">Select public IP option</option>
755+
<option value="true">Enable Public IP</option>
756+
<option value="false">Disable Public IP</option>
757+
</select>
758+
</div> */}
740759
</div>
741760

742761
{/* Optional Details

src/app/components/ConnectionModal.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
export default function ConnectionModal({ isOpen, onClose, children }) {
2+
if (!isOpen) return null;
3+
4+
return (
5+
<div className="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-50">
6+
<div className="bg-white rounded-lg max-w-2xl w-full max-h-[90vh] overflow-y-auto">
7+
<div className="p-6">
8+
<div className="flex justify-between items-center mb-4">
9+
<h2 className="text-2xl font-bold">Connection Instructions</h2>
10+
<button
11+
onClick={onClose}
12+
className="text-gray-500 hover:text-gray-700"
13+
>
14+
<svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
15+
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
16+
</svg>
17+
</button>
18+
</div>
19+
20+
<div>{children}</div>
21+
</div>
22+
</div>
23+
</div>
24+
);
25+
}

src/app/create-project/page.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,11 @@ export default function CreateProject() {
159159
}
160160

161161
setProjectData(projectDetails);
162-
router.push(`/requestresource`);
162+
router.push("/requestresource");
163+
// router.push({
164+
// pathname: "/requestresource",
165+
// query: { projectId: project._id }
166+
// });
163167
} catch (error) {
164168
console.error("Error saving project:", error);
165169
alert("Failed to save project. Please try again.");

0 commit comments

Comments
 (0)