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 Profile as data source #63

Merged
merged 2 commits into from
May 13, 2024
Merged

Conversation

maveonair
Copy link
Member

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 #58:

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.

Signed-off-by: Fabian Mettler <dev@maveonair.com>
Signed-off-by: Fabian Mettler <dev@maveonair.com>
@stgraber stgraber merged commit 1eb9663 into lxc:main May 13, 2024
10 checks passed
@maveonair maveonair deleted the profile-data-source branch May 13, 2024 10:59
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.

None yet

2 participants