Skip to content

Commit

Permalink
Merge pull request #278 from acend/typos_fix
Browse files Browse the repository at this point in the history
fix: fix some typos
  • Loading branch information
sybnex authored Jan 9, 2024
2 parents def5691 + 16c7deb commit b526e14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
2 changes: 1 addition & 1 deletion content/en/docs/05/3-various.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ data "archive_file" "dotfiles" {
}
{{< / highlight >}}

To add such blocks repetitively, we can use the `dyanmic` keyword as documented here:
To add such blocks repetitively, we can use the `dynamic` keyword as documented here:
https://www.terraform.io/docs/language/expressions/dynamic-blocks.html

Create a new file named `main.tf` and add the following content:
Expand Down
26 changes: 11 additions & 15 deletions content/en/docs/05/5-terraform-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sectionnumber: 5.5
---


There are many more topics regarding Terraform. Here we will have look over some of them:
There are many more topics regarding Terraform. Here we will a have look over some of them:

* state inspection
* state remove
Expand All @@ -16,7 +16,7 @@ There are many more topics regarding Terraform. Here we will have look over some

## Task {{% param sectionnumber %}}.1: State Inspection

As you have learned, the Terraform state represents the applied objects which have been successfully applied. Here is the example from our first applied config:
As you have learned, the Terraform state represents the applied objects that have been successfully applied. Here is the example from our first applied config:

```
{
Expand Down Expand Up @@ -51,29 +51,25 @@ As you have learned, the Terraform state represents the applied objects which ha
}
```

You see a normal JSON file which contains every needed information.
You see a normal JSON file that contains every needed information.

{{% alert title="Warning" color="secondary" %}}
This file should be handled as sensible data, as it can contain passwords as well! Nobody should access it, expect Terraform itself!
This file should be handled as sensible data, as it can contain passwords as well! Nobody should access it, except Terraform itself!
{{% /alert %}}


## Task {{% param sectionnumber %}}.2: Remove States from file

Now remove the line "result" from this file and apply again, what happend? Terraform won't update the result field again! Because everything is done from his perspective. Try to delete the complete field of the `acr` resource in the file.
Now remove the line "result" from this file and apply again, what happened? Terraform won't update the result field again! Because everything is done from his perspective. Try to delete the complete field of the `acr` resource in the file.

If you that is tricky, you are right. And that is why you should try to edit this state file. Instead use `terraform destroy` or delete the resource file in the folder.

{{% alert title="Hint" color="secondary" %}}
By delete the line with the `id`, Terraform will re-create the whole resource.
{{% /alert %}}
If you think that this is tricky, you are right. And that is why you shouldn't try to edit this state file. Instead, use `terraform destroy` or delete the resource file in the folder.


## Task {{% param sectionnumber %}}.3: Import

Sometimes you have already created resources in your environment. By describing them afterwards in a Terraform config, Terraform will complain this resources exist already. If you are not able to delete for re-creation you can import it in the actual state file.
Sometimes you have already created resources in your environment. By describing them afterward in a Terraform config, Terraform will complain these resources exist already. If you are not able to delete for re-creation you can import it in the actual state file.

For more informations check out this HashiCorp Learn example: https://learn.hashicorp.com/tutorials/terraform/state-import?in=terraform/state
For more information check out this HashiCorp Learn example: https://learn.hashicorp.com/tutorials/terraform/state-import?in=terraform/state


## Task {{% param sectionnumber %}}.4: Debugging
Expand All @@ -82,7 +78,7 @@ For more informations check out this HashiCorp Learn example: https://learn.hash
As Terraform is really noisy, you should be able to resolve issues by the error message.
{{% /alert %}}

By setting the system env variable `TF_LOG`, Terraform will provide much more information about what's going on. Log Leves are:
By setting the system env variable `TF_LOG`, Terraform will provide much more information about what's going on. Log Levels are:

* TRACE, DEBUG, INFO, WARN or ERROR

Expand All @@ -95,7 +91,7 @@ export TF_LOG="DEBUG"

The use of linting your Terraform config is always a good thing. You can define rules for naming conventions and force people to write readable code.

One example is `tflint` (https://github.com/terraform-linters/tflint). It has a small binary which can be included everywhere and executes fast. Here an output of our simple example from above by running `tflint .`:
One example is `tflint` (https://github.com/terraform-linters/tflint). It has a small binary that can be included everywhere and executes fast. Here an output of our simple example from above by running `tflint .`:

```
2 issue(s) found:
Expand All @@ -120,4 +116,4 @@ You see 2 warnings:
* terraform_required_version is missing
* terraform_required_providers is missing

This is because of the default recommandation to declare and versionize everything correctly. Make the linter happy!
This is because of the default recommendation to declare and versionize everything correctly. Make the linter happy!

0 comments on commit b526e14

Please sign in to comment.