-
Notifications
You must be signed in to change notification settings - Fork 40
Restructure Module for Compatibility with the Crossplane Terraform & OpenTofu Providers #93
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
base: main
Are you sure you want to change the base?
Restructure Module for Compatibility with the Crossplane Terraform & OpenTofu Providers #93
Conversation
|
Thank you. We will review. |
|
Hello, been out for a bit and just getting back to it. But after getting a chance to poke at this a bit more, turns out this is not an issue directly with OpenTofu or Terraform. If applying the module pulled from the Terraform registry, all works as expected with both tools. For us, the issue arises when needing to use the Crossplane Terraform or OpenTofu providers to deploy using this module. Both of these providers only support the use of git-based remote modules, as shown here starting on line 12, https://github.com/upbound/provider-terraform/blob/main/examples/workspace-remote.yaml. To use this module with our Crossplane setup, we currently have to maintain a fork of this repo with the module files isolated in a module folder. It would be ideal to have these changes incorporated into this parent repo so we can avoid the overhead of maintaining the fork and instead, use this repo directly. Hope this extra context helps! Please do let me know if any further questions or issues I can address. Thank you! |
|
Hi @sheppard-brandon-bah – I am hesitant to move all the files into a new path as this will be a breaking change. For git based sourcing, are you doing something like |
|
@alexa-perlov close, like this... git::https://github.com/aws-ia/terraform-aws-bedrock.git//.?ref=v0.0.19 The Terraform CLI does not mind running against the root of the repo like this but OpenTofu and Terragrunt CLIs both pickup files in the /examples and /tests directories which cause them to error out. |
|
hmm, interesting... I will look into this because I'm not sure why you're seeing this behavior. |
|
Thank you and please do let me know how I can assist in this! |
|
let me know if you're able to find another way to integrate into your system that doesn't involve moving the main module files into a new path! I'll keep you updated on what I find... thank you for your patience! |
|
The only thing that came to mind, is being able to provide a list of excluded directories to the tofu/terragrunt plan and apply commands. I have looked and it does not look like this functionality is available. Without being able to exclude those directories (test and examples in this case), the plan and apply commands pickup the .tf files in those directories and try to include them in part of the deployment plan. At least this has been my experience. But I will keep thinking on this and I look forward to hearing what you find, thank you! |
Summary
This PR restructures the repository to support usage with the OpenTofu CLI, ensuring compatibility following Terraform’s transition to the BUSL license.
Background
With the shift from Terraform to OpenTofu, our team — and many others — are adopting OpenTofu to remain aligned with open-source licensing standards. However, OpenTofu enforces stricter parsing behavior across directories, which has introduced issues in the current repo layout.
Problem
The current structure of the repository places all .tf files (including the core module files, test files, and usage examples) in the root directory or subdirectories of the root. When executing OpenTofu commands (e.g., tofu plan, tofu apply) from the root, unrelated .tf files in /test and /examples folders are being picked up and interpreted as part of the configuration.
This results in plan/apply failures due to:
Solution
To resolve this, the PR introduces a new folder structure that isolates the core Bedrock Agent module files into a dedicated directory, /module.
All Terraform source files that comprise the main module are moved into this folder. This ensures that:
Changes
Let me know if you'd like to explore a different approach or if you have a preferred convention for module pathing.
Thanks!