TA-002-P · Question #194
A colleague has informed you that a new version of a Terraform module that your team hosts on an Amazon S3 bucket is broken. The Amazon S3 bucket has versioning enabled. Your colleague tells you to…
The correct answer is C. Delete the latest version of the module in S3 to rollback to the previous version. For modules sourced from S3, Terraform does not support the version argument (that argument is exclusively for the Terraform Registry). While you can technically append a ?version=<S3-version-id> query parameter to an S3 URL, that option is not listed among the choices. Option…
Question
A colleague has informed you that a new version of a Terraform module that your team hosts on an Amazon S3 bucket is broken. The Amazon S3 bucket has versioning enabled. Your colleague tells you to make sure you are not using the latest version in your configuration. You have the following configuration block in your code that refers to the module:
module "infranet" { source = "s3::https://s3-us-west- 2.amazonaws.com/infrabucket/infra_module.zip"} What is the best way to ensure that you are not using the latest version of the module?
Options
- AAdd a module version constraint in your configuration's backend block and specify a
- BAdd a version key to the module configuration and specify a previous version.
- CDelete the latest version of the module in S3 to rollback to the previous version.
- DAdd a version property to the module in Terraform's state file and specify a previous
How the community answered
(30 responses)- A10% (3)
- B3% (1)
- C83% (25)
- D3% (1)
Explanation
For modules sourced from S3, Terraform does not support the version argument (that argument is exclusively for the Terraform Registry). While you can technically append a ?version=<S3-version-id> query parameter to an S3 URL, that option is not listed among the choices. Option B (version key in module config) only works with the Terraform Registry. Option A (backend block) has no version constraint capability for modules. Option D (editing the state file) is dangerous and unsupported. Given the available choices, C - deleting the broken latest version in S3 so that the previous versioned object becomes current - is the only viable method from the list provided.
Topics
Community Discussion
No community discussion yet for this question.