-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(tmc): use real terraform in e2e tests (#1177)
## Reasons for this change Before we used a fake terraform binary that mimicked some Terraform behavior and it supported fully customization of the program's output. The problem is that the fake terraform misses a lot of important details: - `terraform show` gives different error messages depending on different requirements not met. - `terraform show` requires an initialized terraform module and then mimicking this behavior is hard. - `terraform show` checks the lock files - etc if we ignore those details, we miss the opportunity to test those cases and improve Terramate error messages for such errors. _The error message improvements are not addressed in this PR_. ## Changes - Now during the e2e test setup, the Terraform is installed in a temp directory using the hashicorp official `hc-install` library. - Tests were updated to use a real project. - Sandbox library updated to support `copy` and `run` commands.
- Loading branch information
Showing
21 changed files
with
545 additions
and
1,220 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
cmd/terramate/e2etests/_testdata/cloud-sync-drift-plan-file/main.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/** | ||
* Copyright 2023 Terramate GmbH | ||
* SPDX-License-Identifier: MPL-2.0 | ||
*/ | ||
|
||
resource "local_file" "foo" { | ||
content = var.content | ||
filename = "${path.module}/foo.bar" | ||
} | ||
|
||
variable "content" { | ||
sensitive = true | ||
} |
1 change: 1 addition & 0 deletions
1
cmd/terramate/e2etests/_testdata/cloud-sync-drift-plan-file/sanitized.plan.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"format_version":"1.2","terraform_version":"1.5.0","variables":{"content":{"value":"REDACTED_SENSITIVE"}},"planned_values":{"root_module":{"resources":[{"address":"local_file.foo","mode":"managed","type":"local_file","name":"foo","provider_name":"registry.terraform.io/hashicorp/local","schema_version":0,"values":{"content":"REDACTED_SENSITIVE","content_base64":null,"directory_permission":"0777","file_permission":"0777","filename":"./foo.bar","sensitive_content":"REDACTED_SENSITIVE","source":null},"sensitive_values":{"content":true}}]}},"resource_changes":[{"address":"local_file.foo","mode":"managed","type":"local_file","name":"foo","provider_name":"registry.terraform.io/hashicorp/local","change":{"actions":["create"],"before":null,"after":{"content":"REDACTED_SENSITIVE","content_base64":null,"directory_permission":"0777","file_permission":"0777","filename":"./foo.bar","sensitive_content":"REDACTED_SENSITIVE","source":null},"after_unknown":{"content_base64sha256":true,"content_base64sha512":true,"content_md5":true,"content_sha1":true,"content_sha256":true,"content_sha512":true,"id":true},"before_sensitive":false,"after_sensitive":{"content":true,"sensitive_content":true}}}],"configuration":{"provider_config":{"local":{"name":"local","full_name":"registry.terraform.io/hashicorp/local"}},"root_module":{"resources":[{"address":"local_file.foo","mode":"managed","type":"local_file","name":"foo","provider_config_key":"local","expressions":{"content":{"references":["var.content"]},"filename":{"references":["path.module"]}},"schema_version":0}],"variables":{"content":{"sensitive":true}}}},"timestamp":"2023-10-12T14:03:39Z"} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.