@@ -338,6 +338,26 @@ virsh list --all
338
338
1 torrust-tracker-demo running
339
339
```
340
340
341
+ ### 2.4 Refresh OpenTofu State (Important!)
342
+
343
+ ⚠️ ** CRITICAL STEP** : After VM deployment, OpenTofu's state may not immediately
344
+ reflect the VM's IP address assigned by DHCP. This is a known issue where the
345
+ libvirt provider state becomes stale after cloud-init completes.
346
+
347
+ ``` bash
348
+ # [PROJECT_ROOT] Refresh OpenTofu state to detect IP assignment
349
+ time make refresh-state
350
+ ```
351
+
352
+ ** Expected Output** :
353
+
354
+ - OpenTofu state refreshed successfully
355
+ - VM IP address properly detected
356
+ - ** Time** : ~ 3 seconds
357
+
358
+ ** What This Fixes** : Ensures OpenTofu knows the VM's actual IP address, preventing
359
+ "No IP assigned yet" issues in subsequent commands.
360
+
341
361
---
342
362
343
363
## Step 3: Wait for Cloud-Init Completion (Critical!)
@@ -936,10 +956,11 @@ This guide provides a complete integration testing workflow that:
936
956
937
957
1 . ** Creates fresh infrastructure** in ~ 3-5 minutes
938
958
2 . ** Generates configuration files** from templates (~ 2 seconds)
939
- 3 . ** Waits for cloud-init** to complete (~ 2-3 minutes)
940
- 4 . ** Runs comprehensive tests** covering all services (~ 3-5 minutes)
941
- 5 . ** Verifies end-to-end functionality** of the Torrust Tracker
942
- 6 . ** Cleans up resources** when complete
959
+ 3 . ** Refreshes OpenTofu state** to detect VM IP (~ 3 seconds)
960
+ 4 . ** Waits for cloud-init** to complete (~ 2-3 minutes)
961
+ 5 . ** Runs comprehensive tests** covering all services (~ 3-5 minutes)
962
+ 6 . ** Verifies end-to-end functionality** of the Torrust Tracker
963
+ 7 . ** Cleans up resources** when complete
943
964
944
965
** Total Time** : ~ 8-12 minutes for complete cycle
945
966
@@ -958,18 +979,22 @@ During the development of this guide, we identified several critical issues:
958
979
3 . ** SSH Key Configuration** : SSH key setup is ** mandatory** . The ` make setup-ssh-key `
959
980
step must be completed before deployment.
960
981
961
- 4 . ** Non-Default SSH Keys** : If using custom SSH keys (like ` torrust_rsa `
982
+ 4 . ** OpenTofu State Refresh** : After VM deployment, the OpenTofu state may not
983
+ immediately reflect the VM's IP address. The ` make refresh-state ` step (Section 2.4)
984
+ prevents "No IP assigned yet" issues in subsequent commands.
985
+
986
+ 5 . ** Non-Default SSH Keys** : If using custom SSH keys (like ` torrust_rsa `
962
987
instead of ` id_rsa ` ), you must:
963
988
964
989
- Configure the public key in ` infrastructure/terraform/local.tfvars `
965
990
- Set up SSH client configuration or use ` -i ` flag explicitly
966
991
967
- 5 . ** Docker Compose Compatibility** : Cloud-init now installs Docker Compose V2
992
+ 6 . ** Docker Compose Compatibility** : Cloud-init now installs Docker Compose V2
968
993
plugin for better compatibility with modern compose.yaml files. Integration
969
994
tests automatically detect and use the appropriate command (` docker compose `
970
995
or ` docker-compose ` ).
971
996
972
- 6 . ** Cloud-Init Timing** : Cloud-init performs many operations including:
997
+ 7 . ** Cloud-Init Timing** : Cloud-init performs many operations including:
973
998
974
999
- Package downloads and installations
975
1000
- System configuration
@@ -980,7 +1005,7 @@ During the development of this guide, we identified several critical issues:
980
1005
during cloud-init, preventing connectivity blocks that caused completion
981
1006
delays. Actual completion time is typically 2-3 minutes.
982
1007
983
- 7 . ** Debugging Techniques** : Use ` virsh console ` and cloud-init logs to debug
1008
+ 8 . ** Debugging Techniques** : Use ` virsh console ` and cloud-init logs to debug
984
1009
issues when SSH fails.
985
1010
986
1011
### Success Factors
0 commit comments