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

feature: Move force_path_style to use_path_style #3473

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lazzurs
Copy link
Contributor

@lazzurs lazzurs commented Oct 12, 2024

Description

As per the documentation linked below the force_path_style option is now deprecated and should be changed to use_path_style.

https://developer.hashicorp.com/terraform/language/backend/s3#force_path_style

It may be better to add both to allow people to migrate from one to the other but given this is only in one place in the docs I expect there isn't a lot of use and highlighting as a breaking change will make future migration easier and stop being using the now deprecated option.

Fixes #3472 .

TODOs

Read the Gruntwork contribution guidelines.

  • Update the docs.
  • Run the relevant tests successfully, including pre-commit checks.
  • Ensure any 3rd party code adheres with our license policy or delete this line if its not applicable.
  • Include release notes. If this PR is backward incompatible, include a migration guide.

Release Notes (draft)

Updated force_path_style

Migration Guide

Change

force_path_style = true

to

use_path_style = true

@lazzurs lazzurs changed the title [WIP] feature: Move force_path_style to use_path_style feature: Move force_path_style to use_path_style Oct 27, 2024
As per the documentation linked below the force_path_style option is now
deprecated and should be changed to use_path_style.

https://developer.hashicorp.com/terraform/language/backend/s3#force_path_style

As per the comments in gruntwork-io#3472 I have made this PR to support both options
but commented the code and the documentation to indicate that the old
option is now deprecated
@yhakbar
Copy link
Collaborator

yhakbar commented Nov 8, 2024

Hey @lazzurs ,

Thanks for cutting this PR!

We do not want to have Terragrunt require users to use the latest version of OpenTofu/Terraform when they use it. As a consequence, we'll want to support the legacy configuration, in addition to the modern version.

One approach we can take to make this an opt-in breaking change is to include it in Strict Mode.

Please adjust this PR to support both approaches for the sake of backwards compatibility.

Thanks again!

@lazzurs
Copy link
Contributor Author

lazzurs commented Nov 8, 2024

Thanks for the comment.

As the PR is currently structured it would support both the legacy and current configuration without any issues other than if someone decides to use the new option with an older version of Terraform.

Happy to support strict mode, that looks good. I will get this done in the next few days. Thanks for the feedback. It's important to ensure the users have the best experience and I appreciate your focus on that.

@yhakbar
Copy link
Collaborator

yhakbar commented Nov 8, 2024

Ah, I misread your comment @lazzurs . Thanks for pointing that out.

I don't think we need to block this PR on adding strict mode for the legacy feature. We can look to add that in a different PR if you don't want to add that now. What I am seeing is that linting is failing for this PR, however:

remote/remote_state.go:1: : # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig (typecheck)
// Package remote contains code for configuring remote state storage.
config/config.go:33:2: could not import github.com/gruntwork-io/terragrunt/remote (-: # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig) (typecheck)
        "github.com/gruntwork-io/terragrunt/remote"
        ^
cli/commands/terraform/action.go:31:2: could not import github.com/gruntwork-io/terragrunt/remote (-: # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig) (typecheck)
        "github.com/gruntwork-io/terragrunt/remote"
        ^
config/config_as_cty_test.go:14:2: could not import github.com/gruntwork-io/terragrunt/remote (-: # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig) (typecheck)
        "github.com/gruntwork-io/terragrunt/remote"
        ^
configstack/test_helpers_test.go:20:59: invalid operation: cannot index byPath (variable of type TerraformModuleByPath) (typecheck)
func (byPath TerraformModuleByPath) Swap(i, j int)      { byPath[i], byPath[j] = byPath[j], byPath[i] }
                                                          ^
configstack/test_helpers_test.go:21:66: invalid operation: cannot index byPath (variable of type TerraformModuleByPath) (typecheck)
func (byPath TerraformModuleByPath) Less(i, j int) bool { return byPath[i].Path < byPath[j].Path }
                                                                 ^
remote/remote_state_test.go:8:2: could not import github.com/gruntwork-io/terragrunt/remote (-: # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig) (typecheck)
        "github.com/gruntwork-io/terragrunt/remote"
        ^
test/integration_test.go:32:2: could not import github.com/gruntwork-io/terragrunt/remote (-: # github.com/gruntwork-io/terragrunt/remote
remote/remote_state_s3.go:136:3: unknown field S3UsePathStyle in struct literal of type awshelper.AwsSessionConfig) (typecheck)
        "github.com/gruntwork-io/terragrunt/remote"
        ^

Could that be addressed first?

@lazzurs
Copy link
Contributor Author

lazzurs commented Nov 8, 2024

I will get that addressed shortly.

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.

force_path_style in S3 backend is now deprecated
2 participants