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

Remove Interpolation-only expressions from website/docs files #36065

Merged
merged 5 commits into from
Nov 21, 2024

Conversation

nimzo6689
Copy link
Contributor

Interpolation-only expressions are deprecated in Terraform v0.12.14.
See. terraform_deprecated_interpolation - tflint-ruleset-terraform

Fixes #36064

Target Release

1.x.x

@nimzo6689 nimzo6689 requested review from a team as code owners November 20, 2024 13:14
Copy link

hashicorp-cla-app bot commented Nov 20, 2024

CLA assistant check
All committers have signed the CLA.

@nimzo6689 nimzo6689 force-pushed the feature/docs-patch-1 branch from 89f7f37 to f56b8db Compare November 20, 2024 13:25
bschaatsbergen
bschaatsbergen previously approved these changes Nov 20, 2024
Copy link
Member

@bschaatsbergen bschaatsbergen left a comment

Choose a reason for hiding this comment

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

Hey @nimzo6689, thank you for taking the time to submit a PR and make these updates!

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thank you for the PR. It is true this syntax has long been deprecated.

We normally do not accept PRs which do cleanup across the codebase and nothing else for various reasons - mostly ones that have to do with git history and conflicts with pending PRs. However, I think in this particular case we could make an exception.

With that in mind, would you mind also addressing the remaining 7 cases?

./website/docs/language/backend/gcs.mdx:  content  = "${data.terraform_remote_state.foo.greeting}"
./website/docs/language/backend/s3.mdx:    role_arn = "${var.workspace_iam_roles[terraform.workspace]}"
./website/docs/language/modules/develop/providers.mdx:  credentials = "${file("account.json")}"
./website/docs/language/modules/develop/providers.mdx:  credentials = "${file("account.json")}"
./website/docs/language/state/remote-state-data.mdx:  subnet_id = "${data.terraform_remote_state.vpc.subnet_id}"
./website/docs/language/state/remote-state-data.mdx:  subnet_id = "${data.terraform_remote_state.vpc.subnet_id}"
./website/docs/language/state/workspaces.mdx:  count = "${terraform.workspace == "default" ? 5 : 1}"

@nimzo6689
Copy link
Contributor Author

@radeksimko
Thank you for the comment.
I have made the requested modifications, except for the following files:

./website/docs/language/backend/gcs.mdx:  content  = "${data.terraform_remote_state.foo.greeting}"
./website/docs/language/state/remote-state-data.mdx:  subnet_id = "${data.terraform_remote_state.vpc.subnet_id}"
./website/docs/language/state/remote-state-data.mdx:  subnet_id = "${data.terraform_remote_state.vpc.subnet_id}"

The reason these files were not modified is that they contain comments indicating they are written for Terraform <= 0.11, as shown below:

# Terraform >= 0.12
resource "aws_instance" "foo" {
  # ...
  subnet_id = data.terraform_remote_state.vpc.outputs.subnet_id
}

# Terraform <= 0.11
resource "aws_instance" "foo" {
  # ...
  subnet_id = "${data.terraform_remote_state.vpc.subnet_id}"
}

Since string interpolation became optional starting with Terraform v0.12, I decided to leave these lines unchanged.

https://github.com/hashicorp/terraform/blob/v0.12/CHANGELOG.md

First-class expressions: Prior to v0.12, expressions could be used only via string interpolation, like "${var.foo}". Expressions are now fully integrated into the language, allowing them to be used directly as argument values, like ami = var.ami.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks 👍🏻

@radeksimko radeksimko added 1.7-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.8-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.9-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged labels Nov 21, 2024
@radeksimko radeksimko merged commit b4a634c into hashicorp:main Nov 21, 2024
8 checks passed
Copy link
Contributor

Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch.

Copy link
Contributor

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.7-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.8-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.9-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged 1.10-backport If you add this label to a PR before merging, backport-assistant will open a new PR once merged documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Interpolation-only expressions from website/docs files
3 participants