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

Add mock provider level resource overrides #2048

Open
wyardley opened this issue Oct 4, 2024 · 1 comment · May be fixed by #2168
Open

Add mock provider level resource overrides #2048

wyardley opened this issue Oct 4, 2024 · 1 comment · May be fixed by #2168
Assignees
Labels
accepted This issue has been accepted for implementation. enhancement New feature or request
Milestone

Comments

@wyardley
Copy link
Contributor

wyardley commented Oct 4, 2024

OpenTofu Version

OpenTofu v1.8.2
on darwin_arm64
+ provider registry.opentofu.org/hashicorp/random v3.6.3

The problem in your OpenTofu project

While currently tofu (after #1204) supports resource overrides at top level and within run blocks, as mentioned there, it does not yet support mock provider level overrides.

Since this is supported in Terraform, it would be nice to have feature parity with Terraform

Attempted Solutions

mock_provider "random" {
  override_resource {
    target = random_integer.count
    values = {
      result = 58
    }
  }
  alias = "fake"
}

This returns the error

│ Error: Unsupported block type
│ 
│   on main.tftest.hcl line 2, in mock_provider "random":
│    2:   override_resource {
│ 
│ Blocks of type "override_resource" are not expected here.
╵

Proposal

No response

References

No response

@wyardley wyardley added enhancement New feature or request pending-decision This issue has not been accepted for implementation nor rejected. It's still open to discussion. labels Oct 4, 2024
@cam72cam
Copy link
Member

cam72cam commented Oct 4, 2024

Thanks for the issue, we decided to see what the community's interest in this feature is before scheduling it as test is a relatively new feature. I would be interested to know what modules/projects are using this feature, that would help us gauge the level of adoption.

That said, we will triage this in the core team next week and likely mark it as accepted, waiting on a community PR.

@ollevche ollevche added accepted This issue has been accepted for implementation. and removed pending-decision This issue has not been accepted for implementation nor rejected. It's still open to discussion. labels Nov 11, 2024
@ollevche ollevche linked a pull request Nov 14, 2024 that will close this issue
10 tasks
@cam72cam cam72cam added this to the 1.9.0 milestone Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This issue has been accepted for implementation. enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants