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

(Question) Adding ConflictsWith for Provider Block #838

Closed
BBBmau opened this issue Sep 7, 2023 · 3 comments
Closed

(Question) Adding ConflictsWith for Provider Block #838

BBBmau opened this issue Sep 7, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@BBBmau
Copy link

BBBmau commented Sep 7, 2023

Description

When working on migrating the helm provider to the plugin-framework, I noticed that theres no support for a ConflictsWith feature when configuring the provider.

Is this due to the expectation that any provider configuration being done such as setting default values and also checking for conflicts should be done within the Configure function? I ask this due to the response from DefaultValues

#539

Use-cases

ConfigPath and ConfigPaths can conflict with one another within the provider configuration. This is a simple check within the provider configure function, although I want to open this issue for those that run into a similar situation where more Conflicts could arise when developing providers using the plugin-framework

@BBBmau BBBmau added the enhancement New feature or request label Sep 7, 2023
@bflad
Copy link
Member

bflad commented Sep 7, 2023

Hi @BBBmau 👋 Thank you for raising this.

Is this due to the expectation that any provider configuration being done such as setting default values and also checking for conflicts should be done within the Configure function?

That is one potential solution. Providers do not have a "planning" phase, only configuration validation and configuration calls from Terraform. More details about provider configuration validation can be found in the framework website documentation.

I noticed that theres no support for a ConflictsWith feature when configuring the provider.

The terraform-plugin-framework-validators Go module contains validators such as ConflictsWith for individual attributes in the schema definition or Conflicting for provider configuration-level validation.

So for example:

import (
  "github.com/hashicorp/terraform-plugin-framework-validators/providervalidator"
)

func (p ExampleProvider) ConfigValidators(ctx context.Context) []provider.ConfigValidator {
    return []provider.ConfigValidator{
        providervalidator.Conflicting(
            path.MatchRoot("config_path"),
            path.MatchRoot("config_paths"),
        ),
    }
}

Is this what you are looking for in this case?

@bflad bflad added the waiting-response Issues or pull requests waiting for an external response label Sep 7, 2023
@BBBmau
Copy link
Author

BBBmau commented Sep 7, 2023

This is what I was looking for, thank you! I saw that the docs provided this here, https://developer.hashicorp.com/terraform/plugin/framework/resources/validate-configuration

I'll do a more extensive search within the docs the next time around. Thank you for getting back to me!

@BBBmau BBBmau closed this as completed Sep 7, 2023
@github-actions github-actions bot removed the waiting-response Issues or pull requests waiting for an external response label Sep 7, 2023
@github-actions
Copy link

github-actions bot commented Oct 8, 2023

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, 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 Oct 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants