Skip to content

Commit

Permalink
Fix docs when running in dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjackson committed Jun 24, 2024
1 parent 6698e64 commit db7f60e
Show file tree
Hide file tree
Showing 11 changed files with 193 additions and 336 deletions.
11 changes: 5 additions & 6 deletions cmd/dev.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,18 @@ func doUpdates(v view.View, e jumppad.Engine, source string, variables map[strin
v.Logger().Error(err.Error())
}

v.Logger().Debug("Changes detected", "new", len(new), "changed", len(changed), "removed", len(removed))
for _, n := range changed {
v.Logger().Debug("Changed", "resource", n.Metadata().ID)
}

if len(new) > 0 || len(changed) > 0 || len(removed) > 0 {
v.UpdateStatus(
fmt.Sprintf(
"Applying changes, %d resources to add, %d resources changed, %d resources to delete, running up",
len(new),
len(changed),
len(removed),
), true)
), false)

for _, n := range changed {
v.Logger().Debug("Changed", "resource", n.Metadata().ID)
}

_, err := e.ApplyWithVariables(context.Background(), source, variables, variableFile)
if err != nil {
Expand Down
32 changes: 32 additions & 0 deletions examples/docs/docs.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ resource "book" "terraform_basics" {

chapters = [
resource.chapter.introduction,
resource.chapter.installation,
]
}

Expand All @@ -18,4 +19,35 @@ resource "chapter" "introduction" {
page "introduction" {
content = file("./docs/index.mdx")
}
}

resource "chapter" "installation" {
title = "Installation"
tasks = {
manual_installation = resource.task.manual_installation
}

page "introduction" {
content = file("./docs/terraform_basics/installation/manual_installation.mdx")
}
}

resource "task" "manual_installation" {
prerequisites = []

config {
user = "root"
}

condition "installed" {
description = "Is Terraform installed"

check {
script = <<-EOF
which terraform
EOF

failure_message = "Terraform is not installed"
}
}
}
3 changes: 0 additions & 3 deletions examples/docs/docs/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@

In this workshop you will learn the fundamentals Terraform.

Test


## Contents

### Understanding Terraform basics
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,6 @@ After downloading Terraform, unzip the package. Terraform runs as a single binar
To be able to run terraform from any location, ensure that the terraform binary is available on your PATH. You can print a colon-separated list of locations in your PATH by executing `echo $PATH`.
Move the Terraform binary to one of the listed locations e.g. `/usr/local/bin`.

<Task id="installation/manual_installation">
<Instructions>
<Task id="manual_installation">
Install the latest version of Terraform for Linux (AMD64) by downloading it from the [downloads](https://developer.hashicorp.com/terraform/downloads?product_intent=terraform) page and installing it on the PATH.
</Instructions>
<Conditions>
<Condition
id="binary_exists"
target="vscode"
description="The terraform binary exists on the PATH"
/>
<Condition
id="version_latest"
target="vscode"
description="The terraform binary is the latest version"
/>
</Conditions>
</Task>
68 changes: 0 additions & 68 deletions pkg/config/resources/docs/provider_book.go

This file was deleted.

92 changes: 0 additions & 92 deletions pkg/config/resources/docs/provider_chapter.go

This file was deleted.

Loading

0 comments on commit db7f60e

Please sign in to comment.