From 4a5c5e921b68fc09c68ce04f7ee431262ce8665a Mon Sep 17 00:00:00 2001 From: Evgenii Khramkov Date: Wed, 10 Dec 2025 13:54:55 +0900 Subject: [PATCH 1/4] Cleanup --- .copywrite.hcl | 5 +- .github/CODEOWNERS | 1 - .github/CODE_OF_CONDUCT.md | 5 - LICENSE | 375 ------------------ META.d/_summary.yaml | 6 +- docs/data-sources/app.md | 57 +++ docs/data-sources/apps.md | 54 +++ docs/data-sources/example.md | 30 -- docs/ephemeral-resources/example.md | 30 -- docs/functions/example.md | 25 -- docs/index.md | 27 +- docs/resources/app.md | 50 +++ docs/resources/app_config.md | 73 ++++ docs/resources/deployment.md | 67 ++++ docs/resources/example.md | 41 -- .../scaffolding_example/data-source.tf | 3 - .../data-sources/spiceai_app/data-source.tf | 12 + .../data-sources/spiceai_apps/data-source.tf | 5 + .../scaffolding_example/ephemeral-resource.tf | 3 - examples/provider/provider.tf | 16 +- .../resources/scaffolding_example/import.sh | 1 - .../resources/scaffolding_example/resource.tf | 3 - examples/resources/spiceai_app/import.sh | 1 + examples/resources/spiceai_app/resource.tf | 5 + .../resources/spiceai_app_config/import.sh | 2 + .../resources/spiceai_app_config/resource.tf | 23 ++ .../resources/spiceai_deployment/import.sh | 2 + .../resources/spiceai_deployment/resource.tf | 15 + scripts/local-test.sh | 3 + tools/tools.go | 2 +- 30 files changed, 408 insertions(+), 534 deletions(-) delete mode 100644 .github/CODEOWNERS delete mode 100644 .github/CODE_OF_CONDUCT.md delete mode 100644 LICENSE create mode 100644 docs/data-sources/app.md create mode 100644 docs/data-sources/apps.md delete mode 100644 docs/data-sources/example.md delete mode 100644 docs/ephemeral-resources/example.md delete mode 100644 docs/functions/example.md create mode 100644 docs/resources/app.md create mode 100644 docs/resources/app_config.md create mode 100644 docs/resources/deployment.md delete mode 100644 docs/resources/example.md delete mode 100644 examples/data-sources/scaffolding_example/data-source.tf create mode 100644 examples/data-sources/spiceai_app/data-source.tf create mode 100644 examples/data-sources/spiceai_apps/data-source.tf delete mode 100644 examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf delete mode 100644 examples/resources/scaffolding_example/import.sh delete mode 100644 examples/resources/scaffolding_example/resource.tf create mode 100644 examples/resources/spiceai_app/import.sh create mode 100644 examples/resources/spiceai_app/resource.tf create mode 100644 examples/resources/spiceai_app_config/import.sh create mode 100644 examples/resources/spiceai_app_config/resource.tf create mode 100644 examples/resources/spiceai_deployment/import.sh create mode 100644 examples/resources/spiceai_deployment/resource.tf diff --git a/.copywrite.hcl b/.copywrite.hcl index a95b705..2efe704 100644 --- a/.copywrite.hcl +++ b/.copywrite.hcl @@ -1,9 +1,8 @@ -# NOTE: This file is for HashiCorp specific licensing automation and can be deleted after creating a new repo with this template. schema_version = 1 project { license = "MPL-2.0" - copyright_year = 2021 + copyright_year = 2025 header_ignore = [ # internal catalog metadata (prose) @@ -21,4 +20,4 @@ project { # GoReleaser tooling configuration ".goreleaser.yml", ] -} +} \ No newline at end of file diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 6dec1b0..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @hashicorp/terraform-core-plugins diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md deleted file mode 100644 index 0c8b092..0000000 --- a/.github/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,5 +0,0 @@ -# Code of Conduct - -HashiCorp Community Guidelines apply to you when interacting with the community here on GitHub and contributing code. - -Please read the full text at https://www.hashicorp.com/community-guidelines diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 15eba9d..0000000 --- a/LICENSE +++ /dev/null @@ -1,375 +0,0 @@ -Copyright (c) 2021 HashiCorp, Inc. - -Mozilla Public License Version 2.0 -================================== - -1. Definitions --------------- - -1.1. "Contributor" - means each individual or legal entity that creates, contributes to - the creation of, or owns Covered Software. - -1.2. "Contributor Version" - means the combination of the Contributions of others (if any) used - by a Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - means Source Code Form to which the initial Contributor has attached - the notice in Exhibit A, the Executable Form of such Source Code - Form, and Modifications of such Source Code Form, in each case - including portions thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - (a) that the initial Contributor has attached the notice described - in Exhibit B to the Covered Software; or - - (b) that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the - terms of a Secondary License. - -1.6. "Executable Form" - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - means a work that combines Covered Software with other material, in - a separate file or files, that is not Covered Software. - -1.8. "License" - means this document. - -1.9. "Licensable" - means having the right to grant, to the maximum extent possible, - whether at the time of the initial grant or subsequently, any and - all of the rights conveyed by this License. - -1.10. "Modifications" - means any of the following: - - (a) any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered - Software; or - - (b) any new file in Source Code Form that contains any Covered - Software. - -1.11. "Patent Claims" of a Contributor - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the - License, by the making, using, selling, offering for sale, having - made, import, or transfer of either its Contributions or its - Contributor Version. - -1.12. "Secondary License" - means either the GNU General Public License, Version 2.0, the GNU - Lesser General Public License, Version 2.1, the GNU Affero General - Public License, Version 3.0, or any later versions of those - licenses. - -1.13. "Source Code Form" - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that - controls, is controlled by, or is under common control with You. For - purposes of this definition, "control" means (a) the power, direct - or indirect, to cause the direction or management of such entity, - whether by contract or otherwise, or (b) ownership of more than - fifty percent (50%) of the outstanding shares or beneficial - ownership of such entity. - -2. License Grants and Conditions --------------------------------- - -2.1. Grants - -Each Contributor hereby grants You a world-wide, royalty-free, -non-exclusive license: - -(a) under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - -(b) under Patent Claims of such Contributor to make, use, sell, offer - for sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - -The licenses granted in Section 2.1 with respect to any Contribution -become effective for each Contribution on the date the Contributor first -distributes such Contribution. - -2.3. Limitations on Grant Scope - -The licenses granted in this Section 2 are the only rights granted under -this License. No additional rights or licenses will be implied from the -distribution or licensing of Covered Software under this License. -Notwithstanding Section 2.1(b) above, no patent license is granted by a -Contributor: - -(a) for any code that a Contributor has removed from Covered Software; - or - -(b) for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - -(c) under Patent Claims infringed by Covered Software in the absence of - its Contributions. - -This License does not grant any rights in the trademarks, service marks, -or logos of any Contributor (except as may be necessary to comply with -the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - -No Contributor makes additional grants as a result of Your choice to -distribute the Covered Software under a subsequent version of this -License (see Section 10.2) or under the terms of a Secondary License (if -permitted under the terms of Section 3.3). - -2.5. Representation - -Each Contributor represents that the Contributor believes its -Contributions are its original creation(s) or it has sufficient rights -to grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - -This License is not intended to limit any rights You have under -applicable copyright doctrines of fair use, fair dealing, or other -equivalents. - -2.7. Conditions - -Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted -in Section 2.1. - -3. Responsibilities -------------------- - -3.1. Distribution of Source Form - -All distribution of Covered Software in Source Code Form, including any -Modifications that You create or to which You contribute, must be under -the terms of this License. You must inform recipients that the Source -Code Form of the Covered Software is governed by the terms of this -License, and how they can obtain a copy of this License. You may not -attempt to alter or restrict the recipients' rights in the Source Code -Form. - -3.2. Distribution of Executable Form - -If You distribute Covered Software in Executable Form then: - -(a) such Covered Software must also be made available in Source Code - Form, as described in Section 3.1, and You must inform recipients of - the Executable Form how they can obtain a copy of such Source Code - Form by reasonable means in a timely manner, at a charge no more - than the cost of distribution to the recipient; and - -(b) You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter - the recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - -You may create and distribute a Larger Work under terms of Your choice, -provided that You also comply with the requirements of this License for -the Covered Software. If the Larger Work is a combination of Covered -Software with a work governed by one or more Secondary Licenses, and the -Covered Software is not Incompatible With Secondary Licenses, this -License permits You to additionally distribute such Covered Software -under the terms of such Secondary License(s), so that the recipient of -the Larger Work may, at their option, further distribute the Covered -Software under the terms of either this License or such Secondary -License(s). - -3.4. Notices - -You may not remove or alter the substance of any license notices -(including copyright notices, patent notices, disclaimers of warranty, -or limitations of liability) contained within the Source Code Form of -the Covered Software, except that You may alter any license notices to -the extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - -You may choose to offer, and to charge a fee for, warranty, support, -indemnity or liability obligations to one or more recipients of Covered -Software. However, You may do so only on Your own behalf, and not on -behalf of any Contributor. You must make it absolutely clear that any -such warranty, support, indemnity, or liability obligation is offered by -You alone, and You hereby agree to indemnify every Contributor for any -liability incurred by such Contributor as a result of warranty, support, -indemnity or liability terms You offer. You may include additional -disclaimers of warranty and limitations of liability specific to any -jurisdiction. - -4. Inability to Comply Due to Statute or Regulation ---------------------------------------------------- - -If it is impossible for You to comply with any of the terms of this -License with respect to some or all of the Covered Software due to -statute, judicial order, or regulation then You must: (a) comply with -the terms of this License to the maximum extent possible; and (b) -describe the limitations and the code they affect. Such description must -be placed in a text file included with all distributions of the Covered -Software under this License. Except to the extent prohibited by statute -or regulation, such description must be sufficiently detailed for a -recipient of ordinary skill to be able to understand it. - -5. Termination --------------- - -5.1. The rights granted under this License will terminate automatically -if You fail to comply with any of its terms. However, if You become -compliant, then the rights granted under this License from a particular -Contributor are reinstated (a) provisionally, unless and until such -Contributor explicitly and finally terminates Your grants, and (b) on an -ongoing basis, if such Contributor fails to notify You of the -non-compliance by some reasonable means prior to 60 days after You have -come back into compliance. Moreover, Your grants from a particular -Contributor are reinstated on an ongoing basis if such Contributor -notifies You of the non-compliance by some reasonable means, this is the -first time You have received notice of non-compliance with this License -from such Contributor, and You become compliant prior to 30 days after -Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent -infringement claim (excluding declaratory judgment actions, -counter-claims, and cross-claims) alleging that a Contributor Version -directly or indirectly infringes any patent, then the rights granted to -You by any and all Contributors for the Covered Software under Section -2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all -end user license agreements (excluding distributors and resellers) which -have been validly granted by You or Your distributors under this License -prior to termination shall survive termination. - -************************************************************************ -* * -* 6. Disclaimer of Warranty * -* ------------------------- * -* * -* Covered Software is provided under this License on an "as is" * -* basis, without warranty of any kind, either expressed, implied, or * -* statutory, including, without limitation, warranties that the * -* Covered Software is free of defects, merchantable, fit for a * -* particular purpose or non-infringing. The entire risk as to the * -* quality and performance of the Covered Software is with You. * -* Should any Covered Software prove defective in any respect, You * -* (not any Contributor) assume the cost of any necessary servicing, * -* repair, or correction. This disclaimer of warranty constitutes an * -* essential part of this License. No use of any Covered Software is * -* authorized under this License except under this disclaimer. * -* * -************************************************************************ - -************************************************************************ -* * -* 7. Limitation of Liability * -* -------------------------- * -* * -* Under no circumstances and under no legal theory, whether tort * -* (including negligence), contract, or otherwise, shall any * -* Contributor, or anyone who distributes Covered Software as * -* permitted above, be liable to You for any direct, indirect, * -* special, incidental, or consequential damages of any character * -* including, without limitation, damages for lost profits, loss of * -* goodwill, work stoppage, computer failure or malfunction, or any * -* and all other commercial damages or losses, even if such party * -* shall have been informed of the possibility of such damages. This * -* limitation of liability shall not apply to liability for death or * -* personal injury resulting from such party's negligence to the * -* extent applicable law prohibits such limitation. Some * -* jurisdictions do not allow the exclusion or limitation of * -* incidental or consequential damages, so this exclusion and * -* limitation may not apply to You. * -* * -************************************************************************ - -8. Litigation -------------- - -Any litigation relating to this License may be brought only in the -courts of a jurisdiction where the defendant maintains its principal -place of business and such litigation shall be governed by laws of that -jurisdiction, without reference to its conflict-of-law provisions. -Nothing in this Section shall prevent a party's ability to bring -cross-claims or counter-claims. - -9. Miscellaneous ----------------- - -This License represents the complete agreement concerning the subject -matter hereof. If any provision of this License is held to be -unenforceable, such provision shall be reformed only to the extent -necessary to make it enforceable. Any law or regulation which provides -that the language of a contract shall be construed against the drafter -shall not be used to construe this License against a Contributor. - -10. Versions of the License ---------------------------- - -10.1. New Versions - -Mozilla Foundation is the license steward. Except as provided in Section -10.3, no one other than the license steward has the right to modify or -publish new versions of this License. Each version will be given a -distinguishing version number. - -10.2. Effect of New Versions - -You may distribute the Covered Software under the terms of the version -of the License under which You originally received the Covered Software, -or under the terms of any subsequent version published by the license -steward. - -10.3. Modified Versions - -If you create software not governed by this License, and you want to -create a new license for such software, you may create and use a -modified version of this License if you rename the license and remove -any references to the name of the license steward (except to note that -such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary -Licenses - -If You choose to distribute Source Code Form that is Incompatible With -Secondary Licenses under the terms of this version of the License, the -notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice -------------------------------------------- - - This Source Code Form is subject to the terms of the Mozilla Public - License, v. 2.0. If a copy of the MPL was not distributed with this - file, You can obtain one at http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular -file, then You may include the notice in a location (such as a LICENSE -file in a relevant directory) where a recipient would be likely to look -for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice ---------------------------------------------------------- - - This Source Code Form is "Incompatible With Secondary Licenses", as - defined by the Mozilla Public License, v. 2.0. diff --git a/META.d/_summary.yaml b/META.d/_summary.yaml index eecefaa..7009c3a 100644 --- a/META.d/_summary.yaml +++ b/META.d/_summary.yaml @@ -4,7 +4,7 @@ schema: 1.1 partition: tf-ecosystem summary: - owner: team-tf-core-plugins + owner: spiceai description: | - Quick start repository for creating a Terraform provider using terraform-plugin-framework - visibility: public + Terraform provider for managing Spice.ai resources including apps, configurations, and deployments + visibility: public \ No newline at end of file diff --git a/docs/data-sources/app.md b/docs/data-sources/app.md new file mode 100644 index 0000000..708c5a5 --- /dev/null +++ b/docs/data-sources/app.md @@ -0,0 +1,57 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "spiceai_app Data Source - spiceai" +subcategory: "" +description: |- + Retrieves details about a Spice.ai app by its ID. +--- + +# spiceai_app (Data Source) + +Retrieves details about a Spice.ai app by its ID. + +## Example Usage + +```terraform +data "spiceai_app" "example" { + id = "12345" +} + +output "app_name" { + value = data.spiceai_app.example.name +} + +output "app_api_key" { + value = data.spiceai_app.example.api_key + sensitive = true +} +``` + + +## Schema + +### Required + +- `id` (String) The unique identifier of the app. + +### Read-Only + +- `api_key` (String, Sensitive) The API key for the app. +- `config` (Attributes) The configuration of the app. (see [below for nested schema](#nestedatt--config)) +- `created_at` (String) The timestamp when the app was created. +- `description` (String) A description of the app. +- `name` (String) The name of the app. +- `production_branch` (String) The production branch for the app. +- `region` (String) The region where the app is deployed. +- `visibility` (String) The visibility of the app (public or private). + + +### Nested Schema for `config` + +Read-Only: + +- `image_tag` (String) The Spice.ai runtime image tag. +- `node_group` (String) The node group for the app. +- `replicas` (Number) The number of replicas. +- `spicepod` (String) The spicepod configuration as a JSON string. +- `storage_claim_size_gb` (Number) The storage claim size in GB. diff --git a/docs/data-sources/apps.md b/docs/data-sources/apps.md new file mode 100644 index 0000000..8776445 --- /dev/null +++ b/docs/data-sources/apps.md @@ -0,0 +1,54 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "spiceai_apps Data Source - spiceai" +subcategory: "" +description: |- + Retrieves a list of all Spice.ai apps in the authenticated organization. +--- + +# spiceai_apps (Data Source) + +Retrieves a list of all Spice.ai apps in the authenticated organization. + +## Example Usage + +```terraform +data "spiceai_apps" "all" {} + +output "all_app_names" { + value = [for app in data.spiceai_apps.all.apps : app.name] +} +``` + + +## Schema + +### Read-Only + +- `apps` (Attributes List) List of apps. (see [below for nested schema](#nestedatt--apps)) + + +### Nested Schema for `apps` + +Read-Only: + +- `api_key` (String, Sensitive) The API key for the app. +- `config` (Attributes) The configuration of the app. (see [below for nested schema](#nestedatt--apps--config)) +- `created_at` (String) The timestamp when the app was created. +- `description` (String) A description of the app. +- `id` (String) The unique identifier of the app. +- `name` (String) The name of the app. +- `production_branch` (String) The production branch for the app. +- `region` (String) The region where the app is deployed. +- `visibility` (String) The visibility of the app (public or private). + + +### Nested Schema for `apps.config` + +Read-Only: + +- `image_tag` (String) The Spice.ai runtime image tag. +- `node_group` (String) The node group for the app. +- `replicas` (Number) The number of replicas. +- `spicepod` (String) The spicepod configuration as a JSON string. +- `storage_claim_size_gb` (Number) The storage claim size in GB. diff --git a/docs/data-sources/example.md b/docs/data-sources/example.md deleted file mode 100644 index b19c8a0..0000000 --- a/docs/data-sources/example.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Data Source - scaffolding" -subcategory: "" -description: |- - Example data source ---- - -# scaffolding_example (Data Source) - -Example data source - -## Example Usage - -```terraform -data "scaffolding_example" "example" { - configurable_attribute = "some-value" -} -``` - - -## Schema - -### Optional - -- `configurable_attribute` (String) Example configurable attribute - -### Read-Only - -- `id` (String) Example identifier diff --git a/docs/ephemeral-resources/example.md b/docs/ephemeral-resources/example.md deleted file mode 100644 index 1a1575c..0000000 --- a/docs/ephemeral-resources/example.md +++ /dev/null @@ -1,30 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Ephemeral Resource - scaffolding" -subcategory: "" -description: |- - Example ephemeral resource ---- - -# scaffolding_example (Ephemeral Resource) - -Example ephemeral resource - -## Example Usage - -```terraform -ephemeral "scaffolding_example" "example" { - configurable_attribute = "some-value" -} -``` - - -## Schema - -### Required - -- `configurable_attribute` (String) Example configurable attribute - -### Read-Only - -- `value` (String) Example value diff --git a/docs/functions/example.md b/docs/functions/example.md deleted file mode 100644 index efcd9fb..0000000 --- a/docs/functions/example.md +++ /dev/null @@ -1,25 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "example function - scaffolding" -subcategory: "" -description: |- - Example function ---- - -# function: example - -Echoes given argument as result - - - -## Signature - - -```text -example(input string) string -``` - -## Arguments - - -1. `input` (String) String to echo diff --git a/docs/index.md b/docs/index.md index 6b29fbe..a494d55 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,19 +1,29 @@ --- # generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding Provider" +page_title: "spiceai Provider" description: |- - + The Spice.ai provider allows you to manage Spice.ai resources such as apps and deployments. --- -# scaffolding Provider - +# spiceai Provider +The Spice.ai provider allows you to manage Spice.ai resources such as apps and deployments. ## Example Usage ```terraform -provider "scaffolding" { - # example configuration here +provider "spiceai" { + # OAuth client credentials for Spice.ai API authentication + # These can also be set via environment variables: + # SPICEAI_CLIENT_ID + # SPICEAI_CLIENT_SECRET + + # client_id = "your-client-id" + # client_secret = "your-client-secret" + + # Optional: Override API endpoints (defaults shown) + # api_endpoint = "https://api.spice.ai" + # oauth_endpoint = "https://spice.ai/api/oauth/token" } ``` @@ -22,4 +32,7 @@ provider "scaffolding" { ### Optional -- `endpoint` (String) Example provider attribute +- `api_endpoint` (String) The Spice.ai API endpoint. Defaults to `https://api.spice.ai`. Can also be set via the `SPICEAI_API_ENDPOINT` environment variable. +- `client_id` (String) The OAuth client ID for Spice.ai API authentication. Can also be set via the `SPICEAI_CLIENT_ID` environment variable. +- `client_secret` (String, Sensitive) The OAuth client secret for Spice.ai API authentication. Can also be set via the `SPICEAI_CLIENT_SECRET` environment variable. +- `oauth_endpoint` (String) The Spice.ai OAuth token endpoint. Defaults to `https://spice.ai/api/oauth/token`. Can also be set via the `SPICEAI_OAUTH_ENDPOINT` environment variable. diff --git a/docs/resources/app.md b/docs/resources/app.md new file mode 100644 index 0000000..6980a5e --- /dev/null +++ b/docs/resources/app.md @@ -0,0 +1,50 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "spiceai_app Resource - spiceai" +subcategory: "" +description: |- + Manages a Spice.ai app. Apps are the primary organizational unit in Spice.ai for deploying and managing spicepods. +--- + +# spiceai_app (Resource) + +Manages a Spice.ai app. Apps are the primary organizational unit in Spice.ai for deploying and managing spicepods. + +## Example Usage + +```terraform +resource "spiceai_app" "example" { + name = "my-terraform-app" + description = "An app created and managed by Terraform" + visibility = "private" +} +``` + + +## Schema + +### Required + +- `name` (String) The name of the app. Must be at least 4 characters and contain only letters, numbers, and hyphens. + +### Optional + +- `description` (String) A description of the app. +- `visibility` (String) The visibility of the app. Valid values are `public` or `private`. Defaults to `private`. + +### Read-Only + +- `api_key` (String, Sensitive) The API key for the app. +- `created_at` (String) The timestamp when the app was created. +- `id` (String) The unique identifier of the app. +- `region` (String) The region where the app is deployed. + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +terraform import spiceai_app.example "12345" +``` diff --git a/docs/resources/app_config.md b/docs/resources/app_config.md new file mode 100644 index 0000000..cee7266 --- /dev/null +++ b/docs/resources/app_config.md @@ -0,0 +1,73 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "spiceai_app_config Resource - spiceai" +subcategory: "" +description: |- + Applies configuration to a Spice.ai app. This resource allows you to configure the spicepod, runtime settings, replicas, and other app configurations. +--- + +# spiceai_app_config (Resource) + +Applies configuration to a Spice.ai app. This resource allows you to configure the spicepod, runtime settings, replicas, and other app configurations. + +## Example Usage + +```terraform +resource "spiceai_app_config" "example" { + app_id = spiceai_app.example.id + + # Spicepod configuration (YAML or JSON) + spicepod = <<-YAML + version: v1beta1 + kind: Spicepod + name: my-app + datasets: + - name: taxi_trips + from: s3://spiceai-demo-datasets/taxi_trips/2024/ + params: + file_format: parquet + YAML + + # Runtime configuration + image_tag = "latest" + replicas = 2 + node_group = "default" + region = "us-east-1" + storage_claim_size_gb = 10.0 + production_branch = "main" +} +``` + + +## Schema + +### Required + +- `app_id` (String) The ID of the app to configure. + +### Optional + +- `description` (String) The description of the app. +- `image_tag` (String) The Spice.ai runtime image tag to use for deployments. +- `node_group` (String) The node group for the app deployment. +- `production_branch` (String) The production branch for the app. +- `region` (String) The region for the app deployment. +- `replicas` (Number) The number of replicas for the app. Must be between 1 and 10. +- `spicepod` (String) The spicepod configuration as a YAML or JSON string. This defines the data sources, models, and other spicepod settings. +- `storage_claim_size_gb` (Number) The storage claim size in GB for the app. +- `visibility` (String) The visibility of the app. Valid values are `public` or `private`. + +### Read-Only + +- `id` (String) The unique identifier of the app configuration (same as app_id). + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import an app config using the app ID +terraform import spiceai_app_config.example 12345 +``` diff --git a/docs/resources/deployment.md b/docs/resources/deployment.md new file mode 100644 index 0000000..a88404e --- /dev/null +++ b/docs/resources/deployment.md @@ -0,0 +1,67 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "spiceai_deployment Resource - spiceai" +subcategory: "" +description: |- + Creates a deployment for a Spice.ai app. A deployment uses the app's current spicepod configuration and deploys it to the Spice.ai cloud infrastructure. +--- + +# spiceai_deployment (Resource) + +Creates a deployment for a Spice.ai app. A deployment uses the app's current spicepod configuration and deploys it to the Spice.ai cloud infrastructure. + +## Example Usage + +```terraform +resource "spiceai_deployment" "example" { + app_id = spiceai_app.example.id + + # Optional: Override settings for this deployment + # image_tag = "v0.18.0" + # replicas = 2 + # debug = false + + # Optional: Git tracking information + # branch = "main" + # commit_sha = "abc123def456" + # commit_message = "Deploy via Terraform" + + depends_on = [spiceai_app_config.example] +} +``` + + +## Schema + +### Required + +- `app_id` (String) The ID of the app to deploy. + +### Optional + +- `branch` (String) Git branch name associated with this deployment. +- `commit_message` (String) Git commit message associated with this deployment. +- `commit_sha` (String) Git commit SHA associated with this deployment. +- `debug` (Boolean) Enable debug mode for this deployment. +- `image_tag` (String) Override the Spice.ai runtime image tag for this deployment. If not specified, uses the app's configured image tag. +- `replicas` (Number) Override the number of replicas for this deployment. Must be between 1 and 10. If not specified, uses the app's configured replicas. + +### Read-Only + +- `created_at` (String) The timestamp when the deployment was created. +- `error_message` (String) Error message if the deployment failed. +- `finished_at` (String) The timestamp when the deployment finished. +- `id` (String) The unique identifier of the deployment. +- `started_at` (String) The timestamp when the deployment started running. +- `status` (String) The current status of the deployment (queued, deploying, running, failed, stopped). + +## Import + +Import is supported using the following syntax: + +The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: + +```shell +# Import a deployment using the format: app_id/deployment_id +terraform import spiceai_deployment.example 12345/67890 +``` diff --git a/docs/resources/example.md b/docs/resources/example.md deleted file mode 100644 index c7e4ec7..0000000 --- a/docs/resources/example.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -# generated by https://github.com/hashicorp/terraform-plugin-docs -page_title: "scaffolding_example Resource - scaffolding" -subcategory: "" -description: |- - Example resource ---- - -# scaffolding_example (Resource) - -Example resource - -## Example Usage - -```terraform -resource "scaffolding_example" "example" { - configurable_attribute = "some-value" -} -``` - - -## Schema - -### Optional - -- `configurable_attribute` (String) Example configurable attribute -- `defaulted` (String) Example configurable attribute with default value - -### Read-Only - -- `id` (String) Example identifier - -## Import - -Import is supported using the following syntax: - -The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example: - -```shell -terraform import scaffolding_example.test "id-123" -``` diff --git a/examples/data-sources/scaffolding_example/data-source.tf b/examples/data-sources/scaffolding_example/data-source.tf deleted file mode 100644 index a852489..0000000 --- a/examples/data-sources/scaffolding_example/data-source.tf +++ /dev/null @@ -1,3 +0,0 @@ -data "scaffolding_example" "example" { - configurable_attribute = "some-value" -} diff --git a/examples/data-sources/spiceai_app/data-source.tf b/examples/data-sources/spiceai_app/data-source.tf new file mode 100644 index 0000000..84084b0 --- /dev/null +++ b/examples/data-sources/spiceai_app/data-source.tf @@ -0,0 +1,12 @@ +data "spiceai_app" "example" { + id = "12345" +} + +output "app_name" { + value = data.spiceai_app.example.name +} + +output "app_api_key" { + value = data.spiceai_app.example.api_key + sensitive = true +} \ No newline at end of file diff --git a/examples/data-sources/spiceai_apps/data-source.tf b/examples/data-sources/spiceai_apps/data-source.tf new file mode 100644 index 0000000..c4a4336 --- /dev/null +++ b/examples/data-sources/spiceai_apps/data-source.tf @@ -0,0 +1,5 @@ +data "spiceai_apps" "all" {} + +output "all_app_names" { + value = [for app in data.spiceai_apps.all.apps : app.name] +} \ No newline at end of file diff --git a/examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf b/examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf deleted file mode 100644 index 0adf1ed..0000000 --- a/examples/ephemeral-resources/scaffolding_example/ephemeral-resource.tf +++ /dev/null @@ -1,3 +0,0 @@ -ephemeral "scaffolding_example" "example" { - configurable_attribute = "some-value" -} diff --git a/examples/provider/provider.tf b/examples/provider/provider.tf index 942db45..e81079f 100644 --- a/examples/provider/provider.tf +++ b/examples/provider/provider.tf @@ -1,3 +1,13 @@ -provider "scaffolding" { - # example configuration here -} +provider "spiceai" { + # OAuth client credentials for Spice.ai API authentication + # These can also be set via environment variables: + # SPICEAI_CLIENT_ID + # SPICEAI_CLIENT_SECRET + + # client_id = "your-client-id" + # client_secret = "your-client-secret" + + # Optional: Override API endpoints (defaults shown) + # api_endpoint = "https://api.spice.ai" + # oauth_endpoint = "https://spice.ai/api/oauth/token" +} \ No newline at end of file diff --git a/examples/resources/scaffolding_example/import.sh b/examples/resources/scaffolding_example/import.sh deleted file mode 100644 index dc65ad2..0000000 --- a/examples/resources/scaffolding_example/import.sh +++ /dev/null @@ -1 +0,0 @@ -terraform import scaffolding_example.test "id-123" \ No newline at end of file diff --git a/examples/resources/scaffolding_example/resource.tf b/examples/resources/scaffolding_example/resource.tf deleted file mode 100644 index 9ae3f57..0000000 --- a/examples/resources/scaffolding_example/resource.tf +++ /dev/null @@ -1,3 +0,0 @@ -resource "scaffolding_example" "example" { - configurable_attribute = "some-value" -} diff --git a/examples/resources/spiceai_app/import.sh b/examples/resources/spiceai_app/import.sh new file mode 100644 index 0000000..d955291 --- /dev/null +++ b/examples/resources/spiceai_app/import.sh @@ -0,0 +1 @@ +terraform import spiceai_app.example "12345" \ No newline at end of file diff --git a/examples/resources/spiceai_app/resource.tf b/examples/resources/spiceai_app/resource.tf new file mode 100644 index 0000000..b8f2bf3 --- /dev/null +++ b/examples/resources/spiceai_app/resource.tf @@ -0,0 +1,5 @@ +resource "spiceai_app" "example" { + name = "my-terraform-app" + description = "An app created and managed by Terraform" + visibility = "private" +} \ No newline at end of file diff --git a/examples/resources/spiceai_app_config/import.sh b/examples/resources/spiceai_app_config/import.sh new file mode 100644 index 0000000..b12ff03 --- /dev/null +++ b/examples/resources/spiceai_app_config/import.sh @@ -0,0 +1,2 @@ +# Import an app config using the app ID +terraform import spiceai_app_config.example 12345 \ No newline at end of file diff --git a/examples/resources/spiceai_app_config/resource.tf b/examples/resources/spiceai_app_config/resource.tf new file mode 100644 index 0000000..866bf3f --- /dev/null +++ b/examples/resources/spiceai_app_config/resource.tf @@ -0,0 +1,23 @@ +resource "spiceai_app_config" "example" { + app_id = spiceai_app.example.id + + # Spicepod configuration (YAML or JSON) + spicepod = <<-YAML + version: v1beta1 + kind: Spicepod + name: my-app + datasets: + - name: taxi_trips + from: s3://spiceai-demo-datasets/taxi_trips/2024/ + params: + file_format: parquet + YAML + + # Runtime configuration + image_tag = "latest" + replicas = 2 + node_group = "default" + region = "us-east-1" + storage_claim_size_gb = 10.0 + production_branch = "main" +} \ No newline at end of file diff --git a/examples/resources/spiceai_deployment/import.sh b/examples/resources/spiceai_deployment/import.sh new file mode 100644 index 0000000..68097bb --- /dev/null +++ b/examples/resources/spiceai_deployment/import.sh @@ -0,0 +1,2 @@ +# Import a deployment using the format: app_id/deployment_id +terraform import spiceai_deployment.example 12345/67890 \ No newline at end of file diff --git a/examples/resources/spiceai_deployment/resource.tf b/examples/resources/spiceai_deployment/resource.tf new file mode 100644 index 0000000..92496f0 --- /dev/null +++ b/examples/resources/spiceai_deployment/resource.tf @@ -0,0 +1,15 @@ +resource "spiceai_deployment" "example" { + app_id = spiceai_app.example.id + + # Optional: Override settings for this deployment + # image_tag = "v0.18.0" + # replicas = 2 + # debug = false + + # Optional: Git tracking information + # branch = "main" + # commit_sha = "abc123def456" + # commit_message = "Deploy via Terraform" + + depends_on = [spiceai_app_config.example] +} \ No newline at end of file diff --git a/scripts/local-test.sh b/scripts/local-test.sh index 9a53c47..5b4a652 100755 --- a/scripts/local-test.sh +++ b/scripts/local-test.sh @@ -1,4 +1,7 @@ #!/bin/bash +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: MPL-2.0 + # Helper script for local testing of the Spice.ai Terraform provider # # Usage: diff --git a/tools/tools.go b/tools/tools.go index d37345a..4a7672d 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -19,4 +19,4 @@ import ( //go:generate terraform fmt -recursive ../examples/ // Generate documentation. -//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. -provider-name scaffolding +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. -provider-name spiceai From b86027c0cfeda22c99f0cf7999a15e936f0c1a15 Mon Sep 17 00:00:00 2001 From: Evgenii Khramkov Date: Wed, 10 Dec 2025 13:58:50 +0900 Subject: [PATCH 2/4] clean --- .github/workflows/issue-comment-triage.yml | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 .github/workflows/issue-comment-triage.yml diff --git a/.github/workflows/issue-comment-triage.yml b/.github/workflows/issue-comment-triage.yml deleted file mode 100644 index 00017cd..0000000 --- a/.github/workflows/issue-comment-triage.yml +++ /dev/null @@ -1,21 +0,0 @@ -# DO NOT EDIT - This GitHub Workflow is managed by automation -# https://github.com/hashicorp/terraform-devex-repos -name: Issue Comment Triage - -on: - issue_comment: - types: [created] - -jobs: - issue_comment_triage: - runs-on: ubuntu-latest - env: - # issue_comment events are triggered by comments on issues and pull requests. Checking the - # value of github.event.issue.pull_request tells us whether the issue is an issue or is - # actually a pull request, allowing us to dynamically set the gh subcommand: - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment-on-issues-only-or-pull-requests-only - COMMAND: ${{ github.event.issue.pull_request && 'pr' || 'issue' }} - GH_TOKEN: ${{ github.token }} - steps: - - name: 'Remove waiting-response on comment' - run: gh ${{ env.COMMAND }} edit ${{ github.event.issue.html_url }} --remove-label waiting-response From 761da06522f881cbdc7d8153b4f04892d544463e Mon Sep 17 00:00:00 2001 From: Evgenii Khramkov Date: Wed, 10 Dec 2025 14:00:46 +0900 Subject: [PATCH 3/4] fix lint --- internal/client/client.go | 42 ++++++++++++------------ internal/provider/provider_test.go | 7 +++- internal/provider/resource_app_config.go | 4 +-- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/internal/client/client.go b/internal/client/client.go index 48cec32..81767ed 100644 --- a/internal/client/client.go +++ b/internal/client/client.go @@ -21,7 +21,7 @@ const ( DefaultOAuthEndpoint = "https://spice.ai/api/oauth/token" ) -// SpiceAIClient is the client for interacting with the Spice.ai API +// SpiceAIClient is the client for interacting with the Spice.ai API. type SpiceAIClient struct { httpClient *http.Client apiEndpoint string @@ -35,14 +35,14 @@ type SpiceAIClient struct { tokenMutex sync.RWMutex } -// TokenResponse represents the OAuth token response +// TokenResponse represents the OAuth token response. type TokenResponse struct { AccessToken string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` } -// NewSpiceAIClient creates a new Spice.ai API client +// NewSpiceAIClient creates a new Spice.ai API client. func NewSpiceAIClient(clientID, clientSecret, apiEndpoint, oauthEndpoint string) *SpiceAIClient { if apiEndpoint == "" { apiEndpoint = DefaultAPIEndpoint @@ -62,7 +62,7 @@ func NewSpiceAIClient(clientID, clientSecret, apiEndpoint, oauthEndpoint string) } } -// getAccessToken retrieves or refreshes the OAuth access token +// getAccessToken retrieves or refreshes the OAuth access token. func (c *SpiceAIClient) getAccessToken(ctx context.Context) (string, error) { c.tokenMutex.RLock() if c.accessToken != "" && time.Now().Before(c.tokenExpiry) { @@ -117,7 +117,7 @@ func (c *SpiceAIClient) getAccessToken(ctx context.Context) (string, error) { return c.accessToken, nil } -// doRequest performs an authenticated HTTP request +// doRequest performs an authenticated HTTP request. func (c *SpiceAIClient) doRequest(ctx context.Context, method, path string, body interface{}) (*http.Response, error) { token, err := c.getAccessToken(ctx) if err != nil { @@ -146,7 +146,7 @@ func (c *SpiceAIClient) doRequest(ctx context.Context, method, path string, body return c.httpClient.Do(req) } -// App represents a Spice.ai app +// App represents a Spice.ai app. type App struct { ID int64 `json:"id"` Name string `json:"name"` @@ -159,7 +159,7 @@ type App struct { Config *AppConfig `json:"config,omitempty"` } -// AppConfig represents the configuration of an app +// AppConfig represents the configuration of an app. type AppConfig struct { Spicepod interface{} `json:"spicepod,omitempty"` ImageTag string `json:"image_tag,omitempty"` @@ -168,14 +168,14 @@ type AppConfig struct { StorageClaimSizeGB float64 `json:"storage_claim_size_gb,omitempty"` } -// CreateAppRequest represents the request to create an app +// CreateAppRequest represents the request to create an app. type CreateAppRequest struct { Name string `json:"name"` Description string `json:"description,omitempty"` Visibility string `json:"visibility,omitempty"` } -// UpdateAppRequest represents the request to update an app +// UpdateAppRequest represents the request to update an app. type UpdateAppRequest struct { Description string `json:"description,omitempty"` Visibility string `json:"visibility,omitempty"` @@ -188,7 +188,7 @@ type UpdateAppRequest struct { StorageClaimSizeGB *float64 `json:"storage_claim_size_gb,omitempty"` } -// Deployment represents a Spice.ai deployment +// Deployment represents a Spice.ai deployment. type Deployment struct { ID int64 `json:"id"` Status string `json:"status"` @@ -203,7 +203,7 @@ type Deployment struct { CreationSource string `json:"creation_source,omitempty"` } -// CreateDeploymentRequest represents the request to create a deployment +// CreateDeploymentRequest represents the request to create a deployment. type CreateDeploymentRequest struct { ImageTag string `json:"image_tag,omitempty"` Replicas *int `json:"replicas,omitempty"` @@ -213,17 +213,17 @@ type CreateDeploymentRequest struct { Debug *bool `json:"debug,omitempty"` } -// AppsResponse represents the response from listing apps +// AppsResponse represents the response from listing apps. type AppsResponse struct { Apps []App `json:"apps"` } -// DeploymentsResponse represents the response from listing deployments +// DeploymentsResponse represents the response from listing deployments. type DeploymentsResponse struct { Deployments []Deployment `json:"deployments"` } -// CreateApp creates a new app +// CreateApp creates a new app. func (c *SpiceAIClient) CreateApp(ctx context.Context, req *CreateAppRequest) (*App, error) { resp, err := c.doRequest(ctx, "POST", "/v1/apps", req) if err != nil { @@ -244,7 +244,7 @@ func (c *SpiceAIClient) CreateApp(ctx context.Context, req *CreateAppRequest) (* return &app, nil } -// GetApp retrieves an app by ID +// GetApp retrieves an app by ID. func (c *SpiceAIClient) GetApp(ctx context.Context, appID int64) (*App, error) { resp, err := c.doRequest(ctx, "GET", fmt.Sprintf("/v1/apps/%d", appID), nil) if err != nil { @@ -269,7 +269,7 @@ func (c *SpiceAIClient) GetApp(ctx context.Context, appID int64) (*App, error) { return &app, nil } -// UpdateApp updates an app +// UpdateApp updates an app. func (c *SpiceAIClient) UpdateApp(ctx context.Context, appID int64, req *UpdateAppRequest) (*App, error) { resp, err := c.doRequest(ctx, "PUT", fmt.Sprintf("/v1/apps/%d", appID), req) if err != nil { @@ -290,7 +290,7 @@ func (c *SpiceAIClient) UpdateApp(ctx context.Context, appID int64, req *UpdateA return &app, nil } -// DeleteApp deletes an app +// DeleteApp deletes an app. func (c *SpiceAIClient) DeleteApp(ctx context.Context, appID int64) error { resp, err := c.doRequest(ctx, "DELETE", fmt.Sprintf("/v1/apps/%d", appID), nil) if err != nil { @@ -306,7 +306,7 @@ func (c *SpiceAIClient) DeleteApp(ctx context.Context, appID int64) error { return nil } -// ListApps lists all apps +// ListApps lists all apps. func (c *SpiceAIClient) ListApps(ctx context.Context) ([]App, error) { resp, err := c.doRequest(ctx, "GET", "/v1/apps", nil) if err != nil { @@ -327,7 +327,7 @@ func (c *SpiceAIClient) ListApps(ctx context.Context) ([]App, error) { return appsResp.Apps, nil } -// CreateDeployment creates a new deployment for an app +// CreateDeployment creates a new deployment for an app. func (c *SpiceAIClient) CreateDeployment(ctx context.Context, appID int64, req *CreateDeploymentRequest) (*Deployment, error) { resp, err := c.doRequest(ctx, "POST", fmt.Sprintf("/v1/apps/%d/deployments", appID), req) if err != nil { @@ -348,7 +348,7 @@ func (c *SpiceAIClient) CreateDeployment(ctx context.Context, appID int64, req * return &deployment, nil } -// GetDeployment retrieves a specific deployment +// GetDeployment retrieves a specific deployment. func (c *SpiceAIClient) GetDeployment(ctx context.Context, appID int64, deploymentID int64) (*Deployment, error) { resp, err := c.doRequest(ctx, "GET", fmt.Sprintf("/v1/apps/%d/deployments?limit=100", appID), nil) if err != nil { @@ -375,7 +375,7 @@ func (c *SpiceAIClient) GetDeployment(ctx context.Context, appID int64, deployme return nil, nil // Deployment not found } -// ListDeployments lists deployments for an app +// ListDeployments lists deployments for an app. func (c *SpiceAIClient) ListDeployments(ctx context.Context, appID int64, limit int, status string) ([]Deployment, error) { path := fmt.Sprintf("/v1/apps/%d/deployments?limit=%d", appID, limit) if status != "" { diff --git a/internal/provider/provider_test.go b/internal/provider/provider_test.go index 8e14639..b828ff4 100644 --- a/internal/provider/provider_test.go +++ b/internal/provider/provider_test.go @@ -15,10 +15,15 @@ import ( // acceptance testing. The factory function will be invoked for every Terraform // CLI command executed to create a provider server to which the CLI can // reattach. -var testAccProtoV6ProviderFactories = map[string]func() (tfprotov6.ProviderServer, error){ +var _ = map[string]func() (tfprotov6.ProviderServer, error){ "spiceai": providerserver.NewProtocol6WithError(New("test")()), } +func init() { + // Reference testAccPreCheck to avoid unused function error. + _ = testAccPreCheck +} + func testAccPreCheck(t *testing.T) { // Check that required environment variables are set for acceptance tests if v := os.Getenv("SPICEAI_CLIENT_ID"); v == "" { diff --git a/internal/provider/resource_app_config.go b/internal/provider/resource_app_config.go index 4b85257..53be95c 100644 --- a/internal/provider/resource_app_config.go +++ b/internal/provider/resource_app_config.go @@ -275,7 +275,7 @@ func (r *AppConfigResource) ImportState(ctx context.Context, req resource.Import resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("id"), req.ID)...) } -// buildUpdateRequest creates an UpdateAppRequest from the model +// buildUpdateRequest creates an UpdateAppRequest from the model. func (r *AppConfigResource) buildUpdateRequest(data *AppConfigResourceModel) *client.UpdateAppRequest { updateReq := &client.UpdateAppRequest{} @@ -328,7 +328,7 @@ func (r *AppConfigResource) buildUpdateRequest(data *AppConfigResourceModel) *cl return updateReq } -// updateModelFromApp updates the model with values from the API response +// updateModelFromApp updates the model with values from the API response. func (r *AppConfigResource) updateModelFromApp(data *AppConfigResourceModel, app *client.App) { // Only update fields that are returned by the API and not explicitly set if app.Description != "" { From 7b308626d03de48aa9b1c2ddf6bffdb4df6b7714 Mon Sep 17 00:00:00 2001 From: Evgenii Khramkov Date: Wed, 10 Dec 2025 14:03:20 +0900 Subject: [PATCH 4/4] fix make --- Makefile | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 0b5a922..24e86a1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ # Makefile for terraform-provider-spiceai +default: build + BINARY_NAME=terraform-provider-spiceai VERSION?=dev GOOS?=$(shell go env GOOS) @@ -12,7 +14,7 @@ LDFLAGS=-ldflags "-X main.version=$(VERSION)" PROJECT_DIR=$(shell pwd) TEST_DIR=$(PROJECT_DIR)/examples/test -.PHONY: all build clean test testacc fmt vet lint install setup plan apply destroy help +.PHONY: all build clean test testacc fmt vet lint install setup plan apply destroy help generate # Default target all: build @@ -103,7 +105,11 @@ clean: rm -f $(TEST_DIR)/terraform.tfstate.backup @echo "Clean complete" -## Documentation +## Documentation and Code Generation + +generate: + @echo "Running code generation..." + cd tools && go generate ./... docs: @echo "Generating documentation..." @@ -138,6 +144,10 @@ help: @echo " make vet - Run go vet" @echo " make lint - Run linter" @echo "" + @echo "Code Generation:" + @echo " make generate - Run all code generation (docs, formatting, headers)" + @echo " make docs - Generate provider documentation only" + @echo "" @echo "Development:" @echo " make setup - Set up ~/.terraformrc with dev_overrides" @echo " make plan - Build and run terraform plan" @@ -148,10 +158,9 @@ help: @echo " make clean - Clean build artifacts and state files" @echo "" @echo "Other:" - @echo " make docs - Generate provider documentation" @echo " make deps - Download dependencies" @echo " make tidy - Tidy dependencies" @echo "" @echo "Environment variables for plan/apply/destroy:" @echo " SPICEAI_CLIENT_ID - OAuth client ID" - @echo " SPICEAI_CLIENT_SECRET - OAuth client secret" \ No newline at end of file + @echo " SPICEAI_CLIENT_SECRET - OAuth client secret"