data "incus_profile" "default" {
name = "default"
}
resource "incus_instance" "d1" {
profiles = [data.incus_profile.default.name]
image = "images:debian/12"
name = "d1"
}
Documentation:
docs/data-sources/profile.md: Added documentation for the new incus_profile data source, including example usage, argument reference, and attribute reference.
Changes:
internal/profile/datasource_profile.go: Created a new Go file datasource_profile.go that includes the ProfileDataSource struct and its associated methods. This struct represents the Incus profile data source, and the methods handle the metadata, schema, configuration, and reading of the data source.
internal/provider/provider.go: Updated the DataSources method of the IncusProvider struct to include the new profile.NewProfileDataSource function, which creates a new instance of the ProfileDataSource.
This pull request introduces a new data source for Incus profiles in the Terraform provider for Incus.
This makes it possible to use an existing profile that was not created by Terraform, such as the default profile as mentioned in https://github.com/lxc/terraform-provider-incus/issues/58:
Documentation:
docs/data-sources/profile.md
: Added documentation for the newincus_profile
data source, including example usage, argument reference, and attribute reference.Changes:
internal/profile/datasource_profile.go
: Created a new Go filedatasource_profile.go
that includes theProfileDataSource
struct and its associated methods. This struct represents the Incus profile data source, and the methods handle the metadata, schema, configuration, and reading of the data source.internal/provider/provider.go
: Updated theDataSources
method of theIncusProvider
struct to include the newprofile.NewProfileDataSource
function, which creates a new instance of theProfileDataSource
.