-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Terraform Version Resource #400
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! I think the only thing you need is to add the new resource to the documentation. (website/r folder)
version := genVersion(rInt) | ||
|
||
resource.Test(t, resource.TestCase{ | ||
PreCheck: func() { testAccPreCheck(t) }, // TODO: Find out what this means |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a couple of these TODOs in the change. What this does is configures the provider with creds, etc against the nightly TFC server and tests that no config errors happened.
09c451b
to
722c8dd
Compare
This commit implements the Terraform version resource block "tfe_terraform_version" which allows practitioners to create and manage Terraform versions on TFE. This commit also outlines two tests for this resource. It generates a mock terraform version using a random version number and SHA. The URL attribute points to hashicorp.com since the TFC API doesn't download or verify that the zip exists when the resource is created. The basic test tests against the required parameters and the full test includes the optional parameters.
722c8dd
to
f25d34f
Compare
* `url` - (Required) The URL where a ZIP-compressed 64-bit Linux binary of this version can be downloaded. | ||
* `sha` - (Required) The SHA-256 checksum of the compressed Terraform binary. | ||
* `official` - (Optional) Whether or not this is an official release of Terraform. Defaults to "false". | ||
* `enabled` - (Optional) Whether or not this version of Terraform is enabled for use in Terraform Cloud. Defaults to "true". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is actually an issue in the API docs, too - this is true of TFE as well as TFC, even though the docs seem to indicate TFC only, IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So just update the docs to say for use in Terraform Cloud or Enterprise
?
Nice work! |
Description
This PR implements the Terraform Version resource for creating and managing terraform versions using TFE provider. The resource block uses the name
tfe_terraform_version
and looks as follows:The Terraform version resource defines the following attributes:
version
- (Required) A semantic version string in N.N.N or N.N.N-bundleName format.url
- (Required) The URL where a ZIP-compressed 64-bit Linux binary of this version can be downloaded.sha
- (Required) The SHA-256 checksum of the compressed Terraform binary.official
- (Optional) Whether or not this is an official release of Terraform. Defaults tofalse
.enabled
- (Optional) Whether or not this version of Terraform is enabled for use in Terraform Cloud. Defaults totrue
.beta
- (Optional) Whether or not this version of Terraform is beta pre-releaseTesting plan
TFE_HOSTNAME
. You can setTFE_TOKEN
to be the user token for yourTFE_HOST
in your credentials file (depending on your TFE version you no longer need aTFE_ADMIN_TOKEN
env var set).TESTARGS="-run TestAccTFETerraformVersion" make testacc
If you wish to run this version of the provider locally ensure you've created a
.tfrc
configuration file with:Create your terraform configuration with the terraform version resource and run
External links
Output from acceptance tests