Skip to content

Remove cloudposse/template provider; migrate to templatefile()#60

Merged
aknysh merged 4 commits into
mainfrom
aknysh/remove-template-provider
Apr 17, 2026
Merged

Remove cloudposse/template provider; migrate to templatefile()#60
aknysh merged 4 commits into
mainfrom
aknysh/remove-template-provider

Conversation

@aknysh

@aknysh aknysh commented Apr 17, 2026

Copy link
Copy Markdown
Contributor

what

  • Remove the cloudposse/template provider from src/versions.tf
  • Replace data "template_file" "userdata" with the core templatefile() function (assigned to a local)
  • Pass base64encode(local.userdata) to module.ec2_instance.user_data_base64
  • Bump test module Go version to 1.26.1 and refresh all test dependencies to latest compatible versions
  • Regenerate README.md / src/README.md via atmos readme

why

  • The cloudposse/template provider is a fork of the long-deprecated hashicorp/template provider. It is unmaintained and does not ship modern platform builds (e.g. no native darwin_arm64 / linux_arm64 in recent releases)
  • Its only data source — template_file — is superseded by the core templatefile() function that has been available in Terraform 0.12+ / OpenTofu 1.0+
  • Removing the dependency simplifies the module's provider graph and eliminates a deprecated transitive requirement for every consumer of this component

references

Summary by CodeRabbit

  • Chores

    • Removed template provider dependency from Terraform configuration; replaced with inline implementation.
    • Updated Go toolchain and testing dependencies to latest stable versions.
  • Documentation

    • Updated README files to reflect provider and dependency changes.

Replace the deprecated `data "template_file"` user-data rendering with the
core `templatefile()` function and drop the `cloudposse/template` provider
from `required_providers`. Also bumps Go test module to 1.26.1 and refreshes
all test dependencies.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aknysh aknysh added the major Breaking changes (or first stable release) label Apr 17, 2026
@coderabbitai

coderabbitai Bot commented Apr 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@aknysh has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 22 minutes and 39 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 22 minutes and 39 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7224de0e-c66b-42a3-9ea6-9bfd77fcb8e1

📥 Commits

Reviewing files that changed from the base of the PR and between 59c413c and a684b0f.

📒 Files selected for processing (5)
  • README.md
  • src/README.md
  • src/main.tf
  • src/remote-state.tf
  • test/fixtures/vendor.yaml
📝 Walkthrough

Walkthrough

The pull request removes a dependency on the CloudPosse template provider by replacing template file data source usage with native Terraform templatefile() function calls. The change also updates Go testing dependencies to use version 1.26.1 and refreshes the module dependency graph.

Changes

Cohort / File(s) Summary
Documentation
README.md, src/README.md
Removed documentation entries for the template provider requirement (version >= 2.2) and the template_file.userdata resource from requirements, providers, and resources tables.
Terraform Provider & Module
src/versions.tf, src/main.tf
Removed template provider declaration from required_providers block. Replaced data "template_file" "userdata" data source with inline locals.userdata computed using templatefile() function; updated EC2 module input to use base64encode(local.userdata) instead.
Go Dependencies
test/go.mod
Updated Go toolchain from 1.24.x to 1.26.1 and refreshed the module dependency graph with advanced versions across direct dependencies (test-helpers, terratest, testify) and substantially restructured indirect dependencies, including AWS SDK v2 upgrades and introduction of additional transitive packages.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

needs-test

Poem

🐰 The template provider bids goodbye,
With templatefile() now standing by,
Dependencies dance to version 1.26,
Terraform's toolkit refreshed and fixed!
Cleaner code, less bloat to convey,
This refactor hops forward today!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: removing the cloudposse/template provider and migrating to the built-in templatefile() function.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch aknysh/remove-template-provider

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mergify mergify Bot requested review from a team April 17, 2026 16:50
@mergify

mergify Bot commented Apr 17, 2026

Copy link
Copy Markdown

Important

Do not edit the README.md directly. It's auto-generated from the README.yaml

Please update the README.yaml file instead.

Could you fix it @aknysh? 🙏

@mergify mergify Bot added the needs-test Needs testing label Apr 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/main.tf`:
- Around line 9-11: The userdata assignment unconditionally calls
templatefile("${path.module}/templates/userdata.sh.tmpl", { user_data =
var.user_data }) which triggers evaluation even when local.enabled is false;
change the userdata expression to only call templatefile when local.enabled is
true (e.g., use a conditional expression that returns null or an empty string
when local.enabled is false) so that templatefile() is skipped and disabled-path
behavior is preserved; update the userdata assignment where templatefile() is
used and reference local.enabled, templatefile(), and var.user_data in the
conditional.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6ff7306-8b93-4c6b-b163-993dc801a8d8

📥 Commits

Reviewing files that changed from the base of the PR and between cb0f630 and 59c413c.

⛔ Files ignored due to path filters (1)
  • test/go.sum is excluded by !**/*.sum
📒 Files selected for processing (5)
  • README.md
  • src/README.md
  • src/main.tf
  • src/versions.tf
  • test/go.mod
💤 Files with no reviewable changes (3)
  • src/README.md
  • README.md
  • src/versions.tf

Comment thread src/main.tf Outdated
@aknysh aknysh self-assigned this Apr 17, 2026
aknysh and others added 2 commits April 17, 2026 12:57
Preserve the disabled-path behavior of the original `data "template_file"`
resource, which was scoped via `count = local.enabled ? 1 : 0`. The `local`
is now only evaluated when the component is enabled, avoiding potential
plan-time failures when `var.user_data` is unset in disabled deployments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The v1.8.0 module pinned `cloudposse/utils` to `>= 1.7.1, < 2.0.0`, which
conflicts with modern components that require `utils >= 2.0.0`. v2.0.0 of
the remote-state module pins `utils >= 2.0.0, < 3.0.0`, resolving the
`terraform init` provider-resolution failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aknysh

aknysh commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

/terratest

Point `account-map` at `cloudposse-terraform-components/aws-account-map`
v1.537.2 (instead of the old monorepo `terraform-aws-components` 1.520.0
which used stack-config 1.5.0 → pinning utils < 2.0.0). Point `vpc` at
aws-vpc v2.2.0 (from v1.536.0). Both modern versions use
`cloudposse/stack-config/yaml//modules/remote-state` 2.0.0, which pins
`cloudposse/utils >= 2.0.0, < 3.0.0` — compatible with the bumped src.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aknysh

aknysh commented Apr 17, 2026

Copy link
Copy Markdown
Contributor Author

/terratest

@mergify mergify Bot requested a review from a team April 17, 2026 19:28
@mergify mergify Bot requested a review from a team April 17, 2026 19:30
@aknysh aknysh added this pull request to the merge queue Apr 17, 2026
Merged via the queue into main with commit 169c6ac Apr 17, 2026
19 checks passed
@aknysh aknysh deleted the aknysh/remove-template-provider branch April 17, 2026 20:35
@github-actions

Copy link
Copy Markdown

These changes were released in v2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

major Breaking changes (or first stable release) needs-test Needs testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants