This blog post will introduce tool Terraform, which we use for deploying testing environments in YSoft. We will cover following topics:

  • What is Terraform?
  • How does it work?
  • Example of use

What is Terraform?

Terraform is a command line tool for building and changing infrastructure in a safe and efficient matter. It can manage resources on most of the popular service providers. In essence, Terraform is simply a tool that takes configuration files as input and generates an execution plan describing what needs to be done to reach the desired state. Do you need to add another server to your cluster? Just add another module to your configuration. Or redeploy your production environment in a matter of minutes? Than Terraform is the right tool.

How does it work?

Infrastructure as a code

Configuration files that define infrastructure are written using high-level configuration syntax. This basically means that blueprint of your production or testing infrastructure can be versioned and treated as you would normally treat any other code. In addition, since we are talking about code, the configuration can be shared and re-used.

Execution plan

Before every Terraform execution, there is planning step, where Terraform generates an execution plan. The execution plan will show you what will happen when you run an execution (when you apply the plan). This way you avoid surprises when you manipulate with your infrastructure.

Terraform state file

How does Terraform determine the current state of infrastructure? The answer is the state file. State file keeps the information about all the resources that were created by execution of the given configuration file. To assure that the information in state file is fresh and up to date, Terraform queries our provider for any changes of our infrastructure (and modifies state file accordingly), before running any operation, meaning: for every plan and apply, Terraform will perform synchronization of a state file with a provider.

Sometimes this behavior can be problematic, for example querying large infrastructures can take a non-trivial amount of time. In this scenarios, we can turn off the synchronizing, which means the cached state will be treated as the record of truth.

Below you can see the picture of the whole execution process.

Example of use

In our example, we will be working with the azure provider. The example configuration files can be used only for the azure provider (hence the configuration files for different providers may and will differ). In our example, it is also expected, that we have set up terraform on our machine and appropriate endpoints to provider beforehand.

Step 1: Write configuration file

The presented configuration file has no expectations regarding previously created resources and it can be executed on its own, without the need to create any resources in advance.

The configuration file that we will write describes following resources:

Now we create an empty directory on the machine where we have installed terraform and within we create a file with name The contents of the  file:

provider "azurerm" {
  subscription_id = "..."
  client_id       = "..."
  client_secret   = "..."
  tenant_id       = "..."

resource "azurerm_resource_group" "test" {
  name     = "test-rg"
  location = "West US 2"

resource "azurerm_virtual_network" "test" {
  name                = "test-vn"
  address_space       = [""]
  location            = "West US 2"
  resource_group_name = "${}"

resource "azurerm_subnet" "test" {
  name                 = "test-sbn"
  resource_group_name  = "${}"
  virtual_network_name = "${}"
  address_prefix       = ""

resource "azurerm_network_interface" "test" {
  name                = "test-nic"
  location            = "West US 2"
  resource_group_name = "${}"

  ip_configuration {
    name                          = "testconfiguration1"
    subnet_id                     = "${}"
    private_ip_address_allocation = "dynamic"

resource "azurerm_virtual_machine" "test" {
  name                  = "test-vm"
  location              = "West US 2"
  resource_group_name   = "${}"
  network_interface_ids = ["${}"]
  vm_size               = "Standard_DS1_v2"

  delete_os_disk_on_termination = true

  storage_image_reference {
    publisher = "Canonical"
    offer     = "UbuntuServer"
    sku       = "16.04-LTS"
    version   = "latest"

  storage_os_disk {
    name              = "myosdisk1"
    caching           = "ReadWrite"
    create_option     = "FromImage"
    managed_disk_type = "Standard_LRS"

  os_profile {
    computer_name  = "hostname"
    admin_username = "testadmin"
    admin_password = "Password1234!"

  os_profile_linux_config {
    disable_password_authentication = false


Step 2: Planning the execution

Now we browse into a directory with our  file and we run command terraform init, which initializes various local settings and data that will be used by subsequent commands.

Secondly, we run command terraform plan, which will output the execution plan, describing which actions Terraform will take in order to change real infrastructure to match the configuration. The output format is similar to the diff format generated by tools such as Git. If terraform plan failed with an error, read the error message and fix the error that occurred. At this stage, it is likely to be a syntax error in the configuration.

Step 3: Applying the plan

If terraform plan ran successfully we are safe to execute terraform apply. Throughout the whole “apply” process terraform will inform us of progress. Once the terraform is done, our environment is ready and we can easily check by logging in to our virtual machine. Also, our directory now contains file terraform.tfstate file, which is state file that corresponds to our newly created infrastructure.


This example was only a very simple one to show how configuration file might look. Terraform offers more on top of that. Configurations can be packed into modules, self-contained packages that are managed as a group. This way we can create reusable parametrizable components and treat these pieces of infrastructure as a black box. Besides that, Terraform can also perform a provisioning of VM and much more.

ARUR_logoY Soft Applied Research and University Relations (ARUR) is a program under which we ysofters:

  • Supervise and consult students working on their theses
  • Support student research positions at research laboratories
  • Offer student internships
  • Give lectures at universities
  • Organize and support student events

This post provides statistics (collected for the last six years) about some of the Y Soft ARUR activities mentioned above.

Theses supervision

During the last six years, 46 bachelor and master theses realized in collaboration with Y Soft were successfully defended. See Figure 1 for a number of theses defended per each year. In 2015, for example, 6 bachelor and 8 master theses were successfully defended. Most of all the theses came from Y Soft R&D in collaboration with the Faculty of Informatics, Masaryk University.

Figure 1

Figure 1. Number of defended theses

More than 75% of all theses defended during the last six years received “A” or “B” grade. See Figure 2 for grades statistics per each year. In 2015, for example, 14 theses were successfully defended and received eight “A” and six “B” grades (i.e., 100% of the theses defended in 2015 received “A” or “B” grade).

Figure 2

Figure 2. Grades of defended theses

Since 2012, five of the students received awards for their theses (see Figure 3).

Figure 3

Figure 3. Number of awards

Part-time positions at Y Soft

14 students were given part-time jobs within the scope of ARUR during the last six years. Some of these part-timers have been working in Y Soft on their bachelor or master thesis for more than a year. There were ten students from the Faculty of Informatics (Masaryk University), two from the Faculty of Electrical Engineering and Communication (Brno University of Technology), and two from the Faculty of Information Technology (Brno University of Technology).

Student positions at research laboratories

Every year, in cooperation with the Faculty of Informatics, Masaryk University, we participate in organizing a competition for talented students who are in the first or the second year of their bachelor studies. During the last six years, we have supported nine students who were winners of the competition. Some students were funded for more than one year. In 2015, six student positions at research laboratories have been funded.

Thanks to all already participating in our ARUR program and we are looking forward for new participants!

We are more than happy to discuss any suggestions and ideas for cooperation you might have.

Contact us:

I spent winter semester of academic year 2014/2015 on Malta studying on local university. As a student of FIT BUT. I had an opportunity to participate in Erasmus+ student exchange program. In Y Soft Corporation I work as a QA Engineer in Jakub Pavlák’s team in R&D Department. During study period I was still part-time employed in Y Soft corp. I would like to express big thanks to my supervisors who allowed me to work from abroad. It was not easy to manage it but I tried to do my best.


University of Malta was founded in 1769 and has 14 faculties. There are more than 11000 students at the university and around 1000 students are foreigners. I studied at Faculty of information and communication technologies that is the newest one and was built in 2007. I took study units that involved programming, object oriented design and business intelligence. Partly I revised my knowledge from previous study program but I also got new experience in neural networks or cryptography basics.

Faculty - Malta

During semester no more than 100 students attend classes, but mostly in higher classes there are mostly 40 students maximally so there is very calm atmosphere during lessons. Teacher approach to the students is much more personal than that is at my home university. Every study unit contains an assignment – home work which helps to get deeper knowledge of subject. In the end semester there was an examination session. Unlike from BUT FIT the session is very short – only two weeks and for every study unit students have only one attempt. At my home university we have three attempts for each study unit.

It took more than month to get all the results from University of Malta – but it was worth waiting for it – I passed all my exams.

There is one interesting thing about UoM especially about one of its teacher. Dr. Vitezslav Nezval works at the Faculty of information and communication technologies. He is an alumnus of BUT and what is more he is a nephew of one famous Czech poet – Vitezslav Nezval.

At UoM there are also some student organizations that organized different types of activities. During whole visit I participated in many activities with other international students. Very often we travelled throughout Malta and also we visited the smaller island Gozo. There were also organized student parties in Paceville and in other places at least twice a week – it was sometimes quite difficult to get up next day for next lesson or work.

Malta – places, nature, local specialties

Maltese islands can be found south from Sicily. They consist of three islands Malta, Gozo and Comino. Whole area of islands is no more than 400 km2 and population counts around 400 000 inhabitants. But this number grows at least three times during tourist season. The capital of Malta is Valletta. There are the most important administrative building amongst many beautiful sights also with restaurants, theaters and shops.


There two languages officially spoken on Malta, Maltese and English. Maltese is a very strange language. It is a kind of mixture of Arabic, Italian and English and also quite difficult to pronounce. Most of Maltese people speak English so there are no problems with understanding. Very exciting place to visit is Paceville. It is a center of many fun activities and social life; there are shopping centers, many hotels, bars, pubs, cinemas and casinos. Most student parties took place here. In this part of Malta there is the highest building of Malta – The Portomaso Tower. It is 98 meters tall and on its top floor a club called Twenty Two. It offers very nice view on the island and very luxury and expensive drinks.

Prices of common foods and drinks in shops are a bit higher than in the Czech republic. But prices for services, dishes and drinks in restaurants, bars etc. are two or three times higher. Living costs on Malta are higher but if you don’t go every week to casino or high society bar, it is affordable. Malta has really exciting nature. There are many places to visits. You can start with cliffs, megalithic temples, churches and cathedrals with big domes. There is one interesting point about churches – on Malta there are around 360 of them and almost all native Maltese people are believers – Roman Catholic. Also there are plenty of beaches on Maltese island – Golden bay, St. Peter’s pool, Ramla beach on Gozo with orange sand or Blue lagoon on Comino.


Very interesting place is city of Mdina. It is former capital of Malta and it is called “Silent city”. Mdina is medieval fortress with cathedrals inside.

There are also other places like Azure window on Gozo or Blue Grotto where you can do scuba diving.


Because I am a beer lover I had to taste local beers but I was really disappointed. Local beer is a very poor taste. I don’t recommend to move to Malta, if you are beer lovers. Even if you can buy some better tasting beers, the variety is very little. From middle of Europe almost no beers are imported, I think, if a Maltese tastes good Czech beer, he will never drink the local one 😉 There are also sold liqueurs made of prickly pear and other tropical fruit are very typical drinks. They are often very sweet.

Maltese wine is worth tasting, there are not many places where to make wine but final product is quite good. Typical Maltese dishes contain mostly seafood and fish. But there are also cooked little snacks called pastizzi with big variety of tastes. Fried rabbit with garlic and wine is also one the typical Maltese dish. The weather on Malta is for almost 8 months in the year really nice, no raining, mostly sunny with tropical temperatures. Only in the winter the temperature is between 10 and 15°C but of course without any snow. Sometimes there are hailstorms. Maltese people are very kind, always willing to help but they have plenty of time for doing everything, they never hurry. I had to adapt to this.


I had a great chance to meet a lot of new people and students from countries all over the world. I learned about different culture and about different style of teaching. I think I also improved my English communication skills and learned new interesting information about information technologies. I gained lots of exciting experience and the whole visit left me with many unforgettable memories.