Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 85


You need to constrain the GitHub provider to version 2.1 or greater.

Which of the following should you put into the Terraform 0.12 configuration's provider block?

Show Answer
Correct Answer: D

To constrain the GitHub provider to version 2.1 or greater in a Terraform 0.12 configuration, you should use the following syntax in the provider block: version = ">= 2.1". This specifies that Terraform should use any version that is 2.1 or higher, meeting the requirement perfectly.

Discussion

29 comments
Sign in to comment
19kiloOption: D
Jul 13, 2022

I found cleaner version of the multiple choices. A- version >= 2.1 B- version ~> 2.1 C- version = "<= 2.1" D- version = ">= 2.1" The answer is D ">= 2.1". Requires quotes I believe.

Chrisler
Sep 7, 2023

A- version >= 2.1 This option is not valid in Terraform's provider block. Terraform uses a specific version string format to specify provider versions, and this format is not compatible with the >= operator. B- version ~> 2.1 This option uses a version constraint that allows Terraform to use any version that is compatible with version 2.1, but it does not enforce using version 2.1 or greater. The ~> operator specifies that it should use a version greater than or equal to 2.1 but less than the next major version. C- version = "<= 2.1" This option constrains the provider to versions less than or equal to 2.1, which is the opposite of what you want. It limits Terraform to use versions up to and including 2.1 but not greater. D- version = ">= 2.1" This option correctly specifies that Terraform should use the GitHub provider version 2.1 or any version greater than 2.1, which matches your requirement of constraining it to version 2.1 or greater.

BereOption: D
Aug 28, 2023

A- version >= 2.1 B- version ~> 2.1 C- version = "<= 2.1" D- version = ">= 2.1" Example: provider "github" { version = ">= 2.1" # Other configurations for the provider }

19kilo
Jul 14, 2022

Answer is D version = ">= 2.1" View the "Terraform 0.12 and earlier:" example section in the link. https://registry.terraform.io/providers/integrations/github/latest/docs It fails if the = sign is missing, the same is true if the quotes are missing.

geekneekOption: D
Aug 16, 2022

I vote D. version = ">= 1.2.0, < 2.0.0" A version constraint is a string literal containing one or more conditions, which are separated by commas. Each condition consists of an operator and a version number. Version numbers should be a series of numbers separated by periods (like 1.2.0), optionally with a suffix to indicate a beta release. The following operators are valid: = (or no operator): Allows only one exact version number. Cannot be combined with other conditions. !=: Excludes an exact version number. >, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions, and "less-than" requests older versions. ~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0. This is usually called the pessimistic constraint operator. https://www.terraform.io/language/expressions/version-constraints

eduvar4Option: D
Sep 27, 2022

https://developer.hashicorp.com/terraform/language/expressions/version-constraints

InformationOverloadOption: D
Jan 2, 2023

version = ">= 2.1"

NunyabiznesOption: D
Mar 24, 2023

To constrain the GitHub provider to version 2.1 or greater in a Terraform 0.12 configuration, you should use the following constraint in the provider block: D. version = ">= 2.1" This constraint indicates that the provider version must be greater than or equal to 2.1. Here's an example of how to configure this in the provider block: ``` provider "github" { version = ">= 2.1" ... } ``` This ensures that the GitHub provider used will be at least version 2.1, allowing for any version greater than or equal to 2.1.

bigboi23Option: A
May 18, 2022

>, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions, and "less-than" requests older versions.

habbypat123
May 20, 2022

The answer is A

EltoothOption: A
Jun 28, 2022

A is correct answer. https://www.terraform.io/language/expressions/version-constraints

Eltooth
Jul 6, 2022

version ~>2.1 would only allow versions greater than 2.1 but less than 3.0

Nani0107Option: D
Aug 11, 2022

Answer is D version = ">= 2.1"

yaza
Oct 1, 2022

A is false you should have version = ....

agmesasOption: D
Feb 6, 2023

D. version = ">= 2.1" (must be a literal string)

campsOption: D
Mar 31, 2023

. version = ">= 2.1" In Terraform, the provider block is used to configure a provider plugin that Terraform uses to interact with a specific cloud or service. The version argument in the provider block is used to constrain the version of the provider plugin that Terraform should use.

kiran15789Option: D
May 7, 2023

based on 19kilo cleaner version

Mikhael1984
Aug 15, 2023

For 0.12 version (1.1.x and earlier), exactly, refer https://developer.hashicorp.com/terraform/language/v1.1.x/expressions/version-constraints. = (or no operator): Allows only one exact version number. Cannot be combined with other conditions. !=: Excludes an exact version number. >, >=, <, <=: Comparisons against a specified version, allowing versions for which the comparison is true. "Greater-than" requests newer versions, and "less-than" requests older versions. ~>: Allows only the rightmost version component to increment. For example, to allow new patch releases within a specific minor release, use the full version number: ~> 1.0.4 will allow installation of 1.0.5 and 1.0.10 but not 1.1.0. This is usually called the pessimistic constraint operator.

Hp45
Sep 6, 2023

The votes seem incorrect. Correct answer should be the ~ sign. See the provider block on registry page:- aws = { source = "hashicorp/aws" version = "~> 5.0"

gofavad926Option: D
Sep 29, 2023

D- version = ">= 2.1"

090200f
Jul 14, 2024

version = ג€>= 2.1ג€ why option D showing like this? not version = ">=2.1" ? any idea. even in exam they will give like this lambda exp?

Roro_BrotherOption: A
May 19, 2022

https://www.terraform.io/language/expressions/version-constraints

elvancedonzyOption: A
Jun 3, 2022

A is the answer

bp339Option: A
Jun 4, 2022

A is right

stalk98
Jun 6, 2022

A is the answer

kopper2019
Aug 10, 2022

Dm since it needs quotes A- version >= 2.1 B- version ~> 2.1 C- version = "<= 2.1" D- version = ">= 2.1"

Ahmed_ElmelegyOption: D
Mar 16, 2023

= ">= "

Power123
Mar 31, 2023

D is correct .version = ">= 2.1"

Ni33Option: D
May 9, 2023

D is the correct option

smitttt
Mar 29, 2024

in 0.12 terraform version >=2.1, <3.0.0 in 0.13 or later terraform version ~> 2.1