<commit_before># Examples for terraform-provider-upcloud

This is a full example which shows how you can set up your own UpCloud instance by using Terraform.

## Initializing local environment

Get and install the provider:

```sh
$ git clone <EMAIL>@github.<EMAIL>:UpCloudLtd/terraform-provider-upcloud.git
$ cd terraform-provider-upcloud
```

Build and symlink the provider into a folder (also make sure it exists) where Terraform looks for it:

```sh
$ make
$ mkdir -p $HOME/.terraform.d/plugins
$ ln -s $GOBIN/terraform-provider-upcloud $HOME/.terraform.d/plugins
```

Clone this example and init Terraform in the example folder:

```sh
$ cd terraform-upcloud-provider/examples
$ terraform init

Initializing the backend...

Initializing provider plugins...

Terraform has been successfully initialized!
...
```

## Configuring the plan

Set up your credentials to `server.tf`. Modify `login` block accordingly and set up your own SSH keys.
In this example you can also remove `keys` parameter, since UpCloud will auto generate a password for you
and deliver it via SMS.

Plan your changes.

```
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be<commit_msg>chore: update the initializing local environment section<commit_after># Examples for terraform-provider-upcloud

This is a full example which shows how you can set up your own UpCloud instance by using Terraform.

## Initializing local environment

Copy the `server.tf` example and run `terraform init` in the working directory.

```
$ terraform init

Initializing the backend...

Initializing provider plugins...
- Using previously-installed registry.upcloud.com/upcloud/upcloud v0.1.0

The following providers do not have any version constraints in configuration,
so the latest version was installed.

To prevent automatic upgrades to new major versions that may contain breaking
changes, we recommend adding version constraints in a required_providers block
in your configuration, with the constraint strings suggested below.

* registry.upcloud.com/upcloud/upcloud: version = "~> 0.1.0"

Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
```

## Configuring the plan

Set up your credentials to `server.tf`. Modify `login` block accordingly and set up your own SSH keys.
In this example you can also remove `keys` parameter, since UpCloud will auto generate a password for you
and deliver it via SMS.

Plan your changes.

```
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
{'fraction_non_alphanumeric': 0.06375838926174497, 'fraction_numerical': 0.0020134228187919465, 'mean_word_length': 4.54089219330855, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '305670', 'n_tokens_mistral': 789, 'n_tokens_neox': 783, 'n_words': 398}