Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Lab-Terraform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LSDS
Teaching
Bachelor
Cloud-and-Deployment
Lab-Terraform
Commits
e0b24a16
Unverified
Commit
e0b24a16
authored
5 months ago
by
Marco Emilio "sphakka" Poleggi
Browse files
Options
Downloads
Patches
Plain Diff
More instructions for Task #10
Signed-off-by:
Marco Emilio "sphakka" Poleggi
<
marcoep@ieee.org
>
parent
cdde425d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
SwitchEngines/README.md
+26
-11
26 additions, 11 deletions
SwitchEngines/README.md
with
26 additions
and
11 deletions
SwitchEngines/README.md
+
26
−
11
View file @
e0b24a16
...
@@ -862,6 +862,12 @@ The solution might be something like:
...
@@ -862,6 +862,12 @@ The solution might be something like:
```
hcl
```
hcl
resource
"terraform_data"
"kind_cluster"
{
resource
"terraform_data"
"kind_cluster"
{
# run only when a given resource processing has terminated
depends_on
=
[...]
# rerun when something else has changed, e.g., a conf file
triggers_replace
=
[...]
connection
{
connection
{
type
=
"ssh"
type
=
"ssh"
user
=
...
user
=
...
...
@@ -880,11 +886,20 @@ resource "terraform_data" "kind_cluster" {
...
@@ -880,11 +886,20 @@ resource "terraform_data" "kind_cluster" {
provisioner
"remote-exec"
{
provisioner
"remote-exec"
{
inline
=
[
inline
=
[
"shell command"
,
# force the script to terminate at the first failure
...
"set -o errexit"
,
"other shell command"
,
...,
# allow background jobs (Docker, kernel, etc.) to terminate
"sleep 30"
]
]
}
}
}
}
resource
"terraform_data"
"metallb_service"
{
# same structure as above
...
}
```
```
:bulb: Please mind that:
:bulb: Please mind that:
...
@@ -896,18 +911,18 @@ can test the creation of the two resources separately.
...
@@ -896,18 +911,18 @@ can test the creation of the two resources separately.
-
Since the lines of a
`remote-exec`
are merged into a script, it is wise to
-
Since the lines of a
`remote-exec`
are merged into a script, it is wise to
start it with the command
`set -o errexit`
, so that the whole script exits
start it with the command
`set -o errexit`
, so that the whole script exits
at the first error.
at the first error.
-
Using
*variable/resource references*
imposes implicit processing of changed
:warning: You will probably hit some thorny issues:
resources. However, to ensure the correct processing flow, some dependencies
should be explicitly imposed via arguments
`depends_on`
and
-
Depending on how you code the
`terraform_data`
block(s), the resource(s)
`triggers_replace`
. Failing to do so might cause the
`terraform_data`
might get processed too soon or in the wrong order. So, be sure of using
resource processing to start before the
`app_server`
has been finalized.
*variable references*
so as to induce indirect dependencies. You might also
need to explicitly declare a
`depends_on`
list.
-
Before doing anything, you must wait for Cloud-init to finish its tasks:
-
Before doing anything, you must wait for Cloud-init to finish its tasks:
this can take several minutes (at least 4-5).
this can take several minutes (at most 4-5). You can probe it with a
remote-exec command
`cloud-init status --wait`
.
-
KinD and K8s are very complex and, during set up, might fail in unexpected
-
KinD and K8s are very complex and, during set up, might fail in unexpected
ways, chiefly because of system/network issues. Thus, it is wise to wait a
ways, chiefly because of system/network issues. Thus, it is wise to wait a
bit (at least 20-30 seconds) after each
`kind/kubectl`
command.
bit (at least 20-30 seconds) after each
`kind/kubectl`
command (use
`sleep
...`
).
<!--
<!--
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment