Skip to content

Latest commit

 

History

History
67 lines (39 loc) · 3.51 KB

File metadata and controls

67 lines (39 loc) · 3.51 KB

Lab: Version Constraints

Help for the VSCode editor.

Providers are semantically versioned which helps you to know how much change to expect in their functionality when upgrading - i.e. is it likely to break existing configuration when upgraded.

  1. Navigate to the directory /root/terraform-projects/omega where we have added a configuration file. Inspect the file and choose the correct version of the provider
    1. Navigate to the indicated directory in Explorer pane
    2. Inspect the .tf files. Look for a terraform block, where the provider and version are defined.
  2. Now, change to the directory /root/terraform-projects/rotate. We have already initialized the configuration directory using the terraform init command.
    Inspect the rotation.tf file and find out the correct version of the provider plugin that is downloaded.
    Choose the correct version
    1. Navigate to the indicated directory in Explorer pane

    2. Inspect the terraform block. There is an expression for the version, which breaks down as

      • Greater than 3.45.0 and
      • Not equal to 3.46.0 and
      • Less than 3.48.0

      Read the three constraints treating each comma as and. This leaves only one possible answer.

  3. Which one of the below is not a valid version constraint operator?

    Refer to the documentation

    The incorrect one is == because it should be =

  4. We have been working on a project called nautilus under the configuration directory /root/terraform-projects/nautilus.Due to a version mismatch, we don't want to download the aws provider version 3.17.0. Which version constraint can be used to achieve this?

    Since it is a specific version we don't want, then we can use the Not Equals operator which is !=

  5. Now, navigate to the directory /root/terraform-projects/lexicorp where we have added the configuration files. Inspect the file and find out which version of providers will be download.
    1. Look at the kubernetes provider:

      • Greater than 1.12.0 and
      • Not equal to 1.13.1 and
      • Less than 1.13.3

      Terraform will choose the highest version available based on the constraints, therefore 1.13.2

    2. Look at the helm provider. Here it is using the "pessimistic constraint" operator, which will choose the hoigest available version of the last digit in the requested version, so ~> 1.2.0 means the highest available 1.2.x. To find x we need to check the provider documentation.

      You will note that the latest version is much higher than 1.2.4 (2.8.0 at the time of writing) so we'll need to check the version history of the provider.

      1. Near the top where it has
        Providers / hashicorp / helm / Version 2.8.0
        there is a drop-down arrow next to the version. Click it.
      2. In the expanded menu, click View all versions which will grow the menu.
      3. Scroll down to find the 1.2 versions and note the highest 1.2 version. This is the answer for the helm provider - 1.2.4