Skip to content
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 configuration option for terraform plugin dir #787

Merged
merged 6 commits into from
Mar 17, 2021

Conversation

cbuto
Copy link
Contributor

@cbuto cbuto commented Feb 16, 2021

Fixes #565.

I posed a question on the issue itself about testing but its probably better to have the conversation here:

I'm having a hard time figuring out the best way to implement a test that would be easy to maintain long term. Testing that the -plugin-dir option is actually working requires having pre-downloaded providers. I wrote a test that uses a fixture with a pre-downloaded provider locally but i don't think committing the actual provider binary to the repo is a viable solution.

Do you have any suggestions on how to implement an actual test for this?

Thanks!

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implementation LGTM, but would be nice to have an integration test. I think you can test this by doing the following:

  • Take one of the terraform examples we have
  • Create a temporary folder as the plugin dir
  • Run terraform init without configuring plugin dir
  • Move the plugin folder from the created .terraform folder to the temporary path
  • Remove the .terraform folder
  • Run terraform init with the plugin dir configured to the temporary path

modules/terraform/options.go Outdated Show resolved Hide resolved
@cbuto
Copy link
Contributor Author

cbuto commented Feb 17, 2021

Implementation LGTM, but would be nice to have an integration test. I think you can test this by doing the following:

  • Take one of the terraform examples we have
  • Create a temporary folder as the plugin dir
  • Run terraform init without configuring plugin dir
  • Move the plugin folder from the created .terraform folder to the temporary path
  • Remove the .terraform folder
  • Run terraform init with the plugin dir configured to the temporary path

That sounds reasonable, let me give that a shot! thanks!

@cbuto
Copy link
Contributor Author

cbuto commented Feb 18, 2021

@yorinasub17 I wrote up a test for it but its a bit weird since there's not much indication from the terraform init that it actually found providers in the plugin dir. The only thing I could find to differentiate between using pre downloaded providers and not was a string in the init output (unauthenticated):

TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: - Installed hashicorp/null v3.0.0 (unauthenticated)

Here is the output from the test:

$ go test --timeout 30m -run "TestInitPluginDir"
TestInitPluginDir 2021-02-18T10:14:50-05:00 retry.go:91: terraform [init -upgrade=false]
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: Running command terraform with args [init -upgrade=false]
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-02-18T10:14:50-05:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-02-18T10:14:51-05:00 logger.go:66: - Installing hashicorp/null v3.0.0...
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: - Installed hashicorp/null v3.0.0 (signed by HashiCorp)
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: * hashicorp/null: version = "~> 3.0.0"
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: should now work.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: commands will detect it and remind you to do so if necessary.
TestInitPluginDir 2021-02-18T10:14:52-05:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir219793060]
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir219793060]
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: - Installing hashicorp/null v3.0.0...
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: - Installed hashicorp/null v3.0.0 (unauthenticated)
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: * hashicorp/null: version = "~> 3.0.0"
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: should now work.
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-02-18T10:14:52-05:00 logger.go:66: commands will detect it and remind you to do so if necessary.
PASS
ok      github.com/gruntwork-io/terratest/modules/terraform     3.493s

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the test! It mostly looks good. Had one minor nit around cleanup, and also have a suggestion for the concern around verifiability:

Perhaps we can run InitE with the PluginDir configured but before copying the plugins, and verify that it errors? That way we know the -plugin-dir is being passed given that it errors when the folder is empty, and passes when it is not. What do you think?

modules/terraform/init_test.go Show resolved Hide resolved
@cbuto
Copy link
Contributor Author

cbuto commented Feb 18, 2021

Thanks for adding the test! It mostly looks good. Had one minor nit around cleanup, and also have a suggestion for the concern around verifiability:

Perhaps we can run InitE with the PluginDir configured but before copying the plugins, and verify that it errors? That way we know the -plugin-dir is being passed given that it errors when the folder is empty, and passes when it is not. What do you think?

That's a great idea, definitely gives me more confidence that things are working as expected.

Here is what the test looks like now:

 $ go test --timeout 30m -run "TestInitPluginDir"
TestInitPluginDir 2021-02-18T15:21:56-05:00 retry.go:91: terraform [init -upgrade=false]
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: Running command terraform with args [init -upgrade=false]
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-02-18T15:21:56-05:00 logger.go:66: - Installing hashicorp/null v3.0.0...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - Installed hashicorp/null v3.0.0 (signed by HashiCorp)
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: * hashicorp/null: version = "~> 3.0.0"
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: should now work.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: commands will detect it and remind you to do so if necessary.
TestInitPluginDir 2021-02-18T15:21:57-05:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440]
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440]
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Error: Failed to query available provider packages
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Could not retrieve the list of available versions for provider hashicorp/null:
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: provider registry.terraform.io/hashicorp/null was not found in any of the
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: search locations
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-02-18T15:21:57-05:00 retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/null:
provider registry.terraform.io/hashicorp/null was not found in any of the
search locations

- /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440
}
TestInitPluginDir 2021-02-18T15:21:57-05:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440]
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir994093440]
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - Installing hashicorp/null v3.0.0...
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: - Installed hashicorp/null v3.0.0 (unauthenticated)
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: * hashicorp/null: version = "~> 3.0.0"
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: should now work.
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: 
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-02-18T15:21:57-05:00 logger.go:66: commands will detect it and remind you to do so if necessary.
PASS
ok      github.com/gruntwork-io/terratest/modules/terraform     2.896s

Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have one more minor issue around cleanup, but other than that this LGTM! Will kick off the build after you address that and if that passes, we can merge this in.

modules/terraform/init_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@yorinasub17 yorinasub17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM now! Will kick off a build and if it passes, we can merge this in!

@yorinasub17
Copy link
Contributor

Sorry for the delay in getting back to this. It looks like the tests are failing consistently, and only when run all together. I will have to investigate this to see what might be causing the concurrency issues, and will report back findings.

@cbuto
Copy link
Contributor Author

cbuto commented Feb 23, 2021

Sorry for the delay in getting back to this. It looks like the tests are failing consistently, and only when run all together. I will have to investigate this to see what might be causing the concurrency issues, and will report back findings.

Alrightly no problem, let me know if there's something I can help investigate!

@cbuto
Copy link
Contributor Author

cbuto commented Mar 9, 2021

rebased with master. Let me know if there's anything I can help with @yorinasub17!

@cbuto cbuto requested a review from yorinasub17 March 15, 2021 20:26
@yorinasub17
Copy link
Contributor

yorinasub17 commented Mar 17, 2021

@cbuto apologies for the delay in getting back to this. I got busy with other work initiatives and took a long time for me to come back.

I finally got to the bottom of the test failures. In our CI environment we use terraform 0.14, and the plugin folder changed (from plugins to providers) with that version. I can reliably reproduce the test failure on tf14.

Can you update the test to attempt to copy over both .terraform/plugins and .terraform/providers?

@cbuto
Copy link
Contributor Author

cbuto commented Mar 17, 2021

@cbuto apologies for the delay in getting back to this. I got busy with other work initiatives and took a long time for me to come back.

I finally got to the bottom of the test failures. In our CI environment we use terraform 0.14, and the plugin folder changed (from plugins to providers) with that version. I can reliably reproduce the test failure on tf14.

Can you update the test to attempt to copy over both .terraform/plugins and .terraform/providers?

@yorinasub17 No problem, I completely understand! Thanks for digging into this. I was always confused why terraform 0.13 called the directory plugins 😆 .

I updated the test to copy over both directories. I wonder if I should attempt to check the terraform version before doing the copy?

Anyway, the test passes now with both 0.13 and 0.14, let me know what you think:

➜  terraform git:(plugin-dir) ✗ go test --timeout 30m -run "TestInitPluginDir"
TestInitPluginDir 2021-03-17T09:08:37-04:00 retry.go:91: terraform [init -upgrade=false]
TestInitPluginDir 2021-03-17T09:08:37-04:00 logger.go:66: Running command terraform with args [init -upgrade=false]
TestInitPluginDir 2021-03-17T09:08:38-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:38-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:08:38-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:38-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:08:38-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:08:39-04:00 logger.go:66: - Installing hashicorp/null v3.1.0...
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: - Installed hashicorp/null v3.1.0 (signed by HashiCorp)
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: Terraform has created a lock file .terraform.lock.hcl to record the provider
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: selections it made above. Include this file in your version control repository
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: so that Terraform can guarantee to make the same selections by default when
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: you run "terraform init" in the future.
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: should now work.
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: commands will detect it and remind you to do so if necessary.
TestInitPluginDir 2021-03-17T09:08:40-04:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488]
TestInitPluginDir 2021-03-17T09:08:40-04:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488]
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: Error: Failed to query available provider packages
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: Could not retrieve the list of available versions for provider hashicorp/null:
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: provider registry.terraform.io/hashicorp/null was not found in any of the
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: search locations
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66:   - /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:41-04:00 retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/null:
provider registry.terraform.io/hashicorp/null was not found in any of the
search locations

  - /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488
}
TestInitPluginDir 2021-03-17T09:08:41-04:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488]
TestInitPluginDir 2021-03-17T09:08:41-04:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir211329488]
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: - Installing hashicorp/null v3.1.0...
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: - Installed hashicorp/null v3.1.0 (unauthenticated)
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: Terraform has created a lock file .terraform.lock.hcl to record the provider
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: selections it made above. Include this file in your version control repository
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: so that Terraform can guarantee to make the same selections by default when
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: you run "terraform init" in the future.
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: should now work.
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-03-17T09:08:42-04:00 logger.go:66: commands will detect it and remind you to do so if necessary.
PASS
ok      github.com/gruntwork-io/terratest/modules/terraform     6.124s
➜  terraform git:(plugin-dir) ✗ tfenv use 0.13.2                              
Switching default version to v0.13.2
Switching completed
➜  terraform git:(plugin-dir) ✗ go test --timeout 30m -run "TestInitPluginDir"
TestInitPluginDir 2021-03-17T09:09:37-04:00 retry.go:91: terraform [init -upgrade=false]
TestInitPluginDir 2021-03-17T09:09:37-04:00 logger.go:66: Running command terraform with args [init -upgrade=false]
TestInitPluginDir 2021-03-17T09:09:38-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:38-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:09:38-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:38-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:09:38-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:09:39-04:00 logger.go:66: - Installing hashicorp/null v3.1.0...
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: - Installed hashicorp/null v3.1.0 (signed by HashiCorp)
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: * hashicorp/null: version = "~> 3.1.0"
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: should now work.
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: commands will detect it and remind you to do so if necessary.
TestInitPluginDir 2021-03-17T09:09:40-04:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869]
TestInitPluginDir 2021-03-17T09:09:40-04:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869]
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: Error: Failed to query available provider packages
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: Could not retrieve the list of available versions for provider hashicorp/null:
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: provider registry.terraform.io/hashicorp/null was not found in any of the
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: search locations
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: - /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:41-04:00 retry.go:99: Returning due to fatal error: FatalError{Underlying: error while running command: exit status 1; 
Error: Failed to query available provider packages

Could not retrieve the list of available versions for provider hashicorp/null:
provider registry.terraform.io/hashicorp/null was not found in any of the
search locations

- /var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869
}
TestInitPluginDir 2021-03-17T09:09:41-04:00 retry.go:91: terraform [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869]
TestInitPluginDir 2021-03-17T09:09:41-04:00 logger.go:66: Running command terraform with args [init -upgrade=false -plugin-dir=/var/folders/h8/hcvd85715cn2s2wr9zwp13k80000gn/T/TestInitPluginDir865044869]
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: Initializing the backend...
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: Initializing provider plugins...
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: - Finding latest version of hashicorp/null...
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: - Installing hashicorp/null v3.1.0...
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: - Installed hashicorp/null v3.1.0 (unauthenticated)
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: The following providers do not have any version constraints in configuration,
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: so the latest version was installed.
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: To prevent automatic upgrades to new major versions that may contain breaking
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: changes, we recommend adding version constraints in a required_providers block
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: in your configuration, with the constraint strings suggested below.
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: * hashicorp/null: version = "~> 3.1.0"
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: Terraform has been successfully initialized!
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: You may now begin working with Terraform. Try running "terraform plan" to see
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: any changes that are required for your infrastructure. All Terraform commands
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: should now work.
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: 
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: If you ever set or change modules or backend configuration for Terraform,
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: rerun this command to reinitialize your working directory. If you forget, other
TestInitPluginDir 2021-03-17T09:09:42-04:00 logger.go:66: commands will detect it and remind you to do so if necessary.
PASS
ok      github.com/gruntwork-io/terratest/modules/terraform     6.066s

@yorinasub17
Copy link
Contributor

Tests failed, but for an unrelated transient issue, so we can merge this in!

This was referenced Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: How to specify the provider path for Terratest
2 participants