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

Support new cloud block backend for Terraform Cloud #76

Merged
merged 13 commits into from
Mar 15, 2022
Merged

Support new cloud block backend for Terraform Cloud #76

merged 13 commits into from
Mar 15, 2022

Conversation

GoodmanBen
Copy link
Contributor

Resolves #75. Some other files were edited to fix small typos in documentation comments.

Adds a configuration attribute wherein the user specifies if the remote backend is_backend_terraform_cloud. This attribute defaults to false, so existing users not using the cloud block for their remote backend will not need to turn

Testing:

  • Functionality works with a cloud bock specifying the backend with my use case. The tfmigrate block to handle this use case looks as follows:
tfmigrate {
  migration_dir = "."
  is_backend_terraform_cloud = true
  history {
    storage "local" {
      path = "./tfmigrate/history.json"
    }
  }
}

All tests pass when run folder by folder, except for some tests in TestExecutorEnv and TestExecutorDir which are failing when the tfexec folder's tests are run.
image

This might be an issue with how I'm trying to run the tests, since none of my changes should be effecting the presence of executables? If this is indeed a bug from my code changes, or if there is a better way to run the tests, please let me know! It is hard to see how the changes which pass in an integration test would lead to the observed testing error.

tfmigrate/config.go Outdated Show resolved Hide resolved
@minamijoyo
Copy link
Owner

@GoodmanBen Thank you for working on this and fixing many typos 😇

Your patch looks almost good. I left some review comments.

While some tests for executor depends on OS, it's no problem as long as the CI passes, but if you want to run it locally, run the test inside a docker-compose environment. The exact commands that CI is executing are as follows:

- name: docker build
run: docker-compose build
- name: start localstack
run: |
docker-compose up -d localstack
docker-compose run --rm dockerize -wait tcp://localstack:4566 -timeout 60s
docker-compose exec -T localstack /docker-entrypoint-initaws.d/wait_s3_bucket_exists.sh
- name: terraform --version
run: docker-compose run --rm tfmigrate terraform --version
- name: testacc
run: docker-compose run --rm tfmigrate make testacc

As you pointed out in #77, it seems that we need a contribution guide. Sorry for your inconvenience.

@GoodmanBen
Copy link
Contributor Author

@minamijoyo updated with the suggested changes and the linter fix. The NewMigrator interface is now unchanged and the IsBackendTerraformCloud boolean is passed down through the MigratorOption struct.

Copy link
Owner

@minamijoyo minamijoyo left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thank you for your contribution!

@minamijoyo minamijoyo merged commit 76a0310 into minamijoyo:master Mar 15, 2022
@minamijoyo
Copy link
Owner

@GoodmanBen Released it in v0.3.2 🚀

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.

Bug: Error when Terraform Cloud is Remote Backend
2 participants