-
Notifications
You must be signed in to change notification settings - Fork 21
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
Signed-off-by: Evan Lankford <[email protected]>
16c24c0
to
8ccc3fe
Compare
There was a problem hiding this 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.
Yes Sir, this was dumb of me. I apologize, for wasting your time! |
880830c
to
3e7d24a
Compare
Signed-off-by: Evan Lankford <[email protected]>
3e7d24a
to
1db62ad
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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"
}
}
There was a problem hiding this comment.
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.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 )", |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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.
I will re push my changes with only three commits! I apologize, I misunderstood it! |
Closes #233
Hello Maintainers, I'm new to contributing! Please, let me know what needs to change!