diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7c2d096..1eada7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -80,6 +80,9 @@ jobs: curl -X POST "127.27.27.27:8080/api/v1/users" > /dev/null curl -u john@doe.com:pass -X POST -H 'Content-Type: application/json' -d '{"id":"unit_test","name":"Unit Test"}' "127.27.27.27:8080/api/v1/tenants" > /dev/null curl -H "Content-Type: application/x-ndjson" -XPOST "127.27.27.27:9200/_bulk?pretty" --data-binary @.github/workflows/index.jsonl + sleep 3 + curl -H "Content-Type: multipart/form-data" -u john@doe.com:pass -X POST -F fileContent=@internal/resources/flow.py "127.27.27.27:8080/api/v1/namespaces/io.kestra.terraform.data/files?path=/flow.py" + - name: Set up Go uses: actions/setup-go@v4 diff --git a/docs/data-sources/namespace_file.md b/docs/data-sources/namespace_file.md new file mode 100644 index 0000000..0fb3bbc --- /dev/null +++ b/docs/data-sources/namespace_file.md @@ -0,0 +1,38 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "kestra_namespace_file Data Source - terraform-provider-kestra" +subcategory: "" +description: |- + Use this data source to access information about an existing Namespace File +--- + +# kestra_namespace_file (Data Source) + +Use this data source to access information about an existing Namespace File + +## Example Usage + +```terraform +data "kestra_namespace_file" "example" { + namespace = "io.kestra.mynamespace" + filename = "myscript.py" + content = file("myscript.py") +} +``` + + +## Schema + +### Required + +- `content` (String) Content to store in the file, expected to be a UTF-8 encoded string. +- `filename` (String) The filename to the namespace file. +- `namespace` (String) The namespace of the namespace file resource. + +### Optional + +- `tenant_id` (String) The tenant id. + +### Read-Only + +- `id` (String) The ID of this resource. diff --git a/docs/resources/namespace_file.md b/docs/resources/namespace_file.md new file mode 100644 index 0000000..4e319cb --- /dev/null +++ b/docs/resources/namespace_file.md @@ -0,0 +1,57 @@ +--- +# generated by https://github.com/hashicorp/terraform-plugin-docs +page_title: "kestra_namespace_file Resource - terraform-provider-kestra" +subcategory: "" +description: |- + Manages a Kestra Namespace File. +--- + +# kestra_namespace_file (Resource) + +Manages a Kestra Namespace File. + +## Example Usage + +```terraform +resource "kestra_namespace_file" "example" { + namespace = "io.kestra.mynamespace" + filename = "/path/my-file.sh" + content = < +## Schema + +### Required + +- `filename` (String) The path to the namespace file that will be created. +Missing parent directories will be created. +If the file already exists, it will be overridden with the given content. +- `namespace` (String) The namespace of the namespace file resource. + +### Optional + +- `content` (String) Content to store in the file, expected to be a UTF-8 encoded string. +- `tenant_id` (String) The tenant id. + +### Read-Only + +- `id` (String) The ID of this resource. + +## Import + +Import is supported using the following syntax: + +```shell +terraform import kestra_namespace_file.example {{namespace}}/{{filename}} +``` diff --git a/examples/data-sources/kestra_namespace_file/data-source.tf b/examples/data-sources/kestra_namespace_file/data-source.tf new file mode 100644 index 0000000..73f7abb --- /dev/null +++ b/examples/data-sources/kestra_namespace_file/data-source.tf @@ -0,0 +1,5 @@ +data "kestra_namespace_file" "example" { + namespace = "io.kestra.mynamespace" + filename = "myscript.py" + content = file("myscript.py") +} diff --git a/examples/resources/kestra_namespace_file/import.sh b/examples/resources/kestra_namespace_file/import.sh new file mode 100644 index 0000000..057cd01 --- /dev/null +++ b/examples/resources/kestra_namespace_file/import.sh @@ -0,0 +1 @@ +terraform import kestra_namespace_file.example {{namespace}}/{{filename}} diff --git a/examples/resources/kestra_namespace_file/resource.tf b/examples/resources/kestra_namespace_file/resource.tf new file mode 100644 index 0000000..98c3dd4 --- /dev/null +++ b/examples/resources/kestra_namespace_file/resource.tf @@ -0,0 +1,14 @@ +resource "kestra_namespace_file" "example" { + namespace = "io.kestra.mynamespace" + filename = "/path/my-file.sh" + content = <