Skip to content

233 rework the provider configuration #254

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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

d3dfx
Copy link

@d3dfx d3dfx commented May 21, 2025

Closes #233

Hello Maintainers, I'm new to contributing! Please, let me know what needs to change!

@d3dfx d3dfx force-pushed the 233-rework-the-provider-configuration-2 branch from 16c24c0 to 8ccc3fe Compare May 21, 2025 04:01
@maveonair maveonair self-requested a review May 21, 2025 04:55
Copy link
Member

@maveonair maveonair left a comment

Choose a reason for hiding this comment

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

All tests are failing, please fix them before we dive into the review.

@maveonair maveonair requested a review from stgraber May 21, 2025 04:55
@d3dfx
Copy link
Author

d3dfx commented May 21, 2025

All tests are failing, please fix them before we dive into the review.

Yes Sir, this was dumb of me. I apologize, for wasting your time!

@d3dfx d3dfx force-pushed the 233-rework-the-provider-configuration-2 branch from 880830c to 3e7d24a Compare May 23, 2025 02:43
@d3dfx d3dfx force-pushed the 233-rework-the-provider-configuration-2 branch from 3e7d24a to 1db62ad Compare May 23, 2025 23:39
Copy link
Member

@maveonair maveonair left a comment

Choose a reason for hiding this comment

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

@d3dfx Please have a look at my comments.

Furthermore, please read our contribution guidelines and follow our commits structure: https://github.com/lxc/terraform-provider-incus/blob/main/CONTRIBUTING.md

@@ -31,7 +31,8 @@ jobs:
TF_ACC: "1"
GO111MODULE: "on"
INCUS_REMOTE: local
INCUS_ADDR: localhost
INCUS_ADDR: https://localhost:8443
INCUS_FQDN: localhost
Copy link
Member

Choose a reason for hiding this comment

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

Let's still use INCUS_ADDR, no need for INCUS_FQDN

Copy link
Author

Choose a reason for hiding this comment

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

Yes Sir!

@@ -74,29 +73,29 @@ The following arguments are supported:
also be set with the `INCUS_ACCEPT_SERVER_CERTIFICATE` environment variable.
Defaults to `false`

The `remote` block supports:
* `default_remote` - *Optional* - The `address` of the default remote to use.
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure that this should be optional anymore but rather mandatory now.

Copy link
Author

Choose a reason for hiding this comment

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

Understood!

@@ -376,22 +381,6 @@ func connectToIncusServer(instServer incus.InstanceServer) error {
return nil
}

// determineIncusDaemonAddr determines address of the Incusserver daemon.
func determineIncusDaemonAddr(remote IncusProviderRemoteConfig) (string, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Here I don't agree, it should be still possible to use the UNIX socket, not just the HTTPS endpoint.

Copy link
Author

Choose a reason for hiding this comment

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

I believe that it is still possible to use the unix socket by setting the unix scheme in the address like such --> address: unix:///my/unix/path

I will test using the unix:// address tonight to ensure i'm not full of it!

I can also make the unix scheme the default for addresses that dont have a scheme assigned. I think that would meet the intention of the function!

Copy link
Author

Choose a reason for hiding this comment

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

Okay, so it looks like using a unix path does work, I was able to create a test instance with the following config!

provider "incus" {
  generate_client_certificates = true
  accept_remote_certificate    = true
  default_remote               = "unix:///var/lib/incus/unix.socket"

  remote {
    name    = "local"
    address = "unix:///var/lib/incus/unix.socket"
    token   = "token"
  }
}

Copy link
Member

@maveonair maveonair Jun 9, 2025

Choose a reason for hiding this comment

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

Shouldn’t it be that when I set default_remote = "local", it selects one of the remote blocks defined below?

@@ -87,6 +89,10 @@ func (p *IncusProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp
Optional: true,
Description: "The project where project-scoped resources will be created. Can be overridden in individual resources. (default = default)",
},
"default_remote": schema.StringAttribute{
Optional: true,
Description: "The `address` of the default remote to use.",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Description: "The `address` of the default remote to use.",
Description: "The default remote to use when no other remote is defined in a resource.",

Optional: true,
Description: "Set this remote as default.",
Description: "Default project to configure. ( Only for the `incus` protocol )",
Copy link
Member

Choose a reason for hiding this comment

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

The default project is already used always by design, so this should not be needed. What was your intention here?

Copy link
Author

Choose a reason for hiding this comment

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

I added it as it was in the list of requested fields to add it in the ticket #233 .

I think the intention is to make it more similar to this command in the cli --> https://linuxcontainers.org/incus/docs/main/reference/manpages/incus/remote/add/#incus-remote-add-md

I can remove it, if you would like!

Copy link
Member

Choose a reason for hiding this comment

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

Okay, so this means we would make default_remote now required to be set?

}

scheme := remote.Scheme.ValueString()
Copy link
Member

Choose a reason for hiding this comment

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

As mentioned before, the UNIX socket connection should still be usable.

@d3dfx
Copy link
Author

d3dfx commented May 28, 2025

@d3dfx Please have a look at my comments.

Furthermore, please read our contribution guidelines and follow our commits structure: https://github.com/lxc/terraform-provider-incus/blob/main/CONTRIBUTING.md

I will re push my changes with only three commits! I apologize, I misunderstood it!

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

Successfully merging this pull request may close these issues.

Rework the provider configuration
2 participants