generated from hashicorp/terraform-provider-scaffolding
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(): add missing resources + docs (#144)
* feat(): add missing resources + docs * chore(ci): update CI to use super admin kestra config * feat(): doc from plugindocs * feat(): missing props in namespace and tenants * feat(): make email mandatory for user resource as its now in kestra 0.20
- Loading branch information
Showing
20 changed files
with
582 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
kestra: | ||
security: | ||
super-admin: | ||
username: [email protected] | ||
password: Root!1234 | ||
encryption: | ||
secret-key: LWBErwwlb/BQcxWujsm+/scPeO01cTKzvW44GbAWvII= | ||
kafka: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "kestra_app Resource - terraform-provider-kestra" | ||
subcategory: "" | ||
description: |- | ||
Manages an App resource. | ||
--- | ||
|
||
# kestra_app (Resource) | ||
|
||
Manages an App resource. | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `source` (String) The source text. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `uid` (String) The unique identifier. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "kestra_dashboard Resource - terraform-provider-kestra" | ||
subcategory: "" | ||
description: |- | ||
Manages a Dashboard resource. | ||
--- | ||
|
||
# kestra_dashboard (Resource) | ||
|
||
Manages a Dashboard resource. | ||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `source_code` (String) The source code text. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The unique identifier. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
package provider | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
"net/http" | ||
) | ||
|
||
func resourceApp() *schema.Resource { | ||
return &schema.Resource{ | ||
Description: "Manages an App resource.", | ||
|
||
CreateContext: resourceAppCreate, | ||
ReadContext: resourceAppRead, | ||
UpdateContext: resourceAppUpdate, | ||
DeleteContext: resourceAppDelete, | ||
Schema: map[string]*schema.Schema{ | ||
"source": { | ||
Description: "The source text.", | ||
Type: schema.TypeString, | ||
Required: true, | ||
}, | ||
"uid": { | ||
Description: "The unique identifier.", | ||
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
}, | ||
} | ||
} | ||
|
||
func resourceAppCreate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
c := meta.(*Client) | ||
var diags diag.Diagnostics | ||
|
||
source := d.Get("source").(string) | ||
|
||
req, reqErr := c.yamlRequest("POST", fmt.Sprintf("%s/apps", apiRoot(c.TenantId)), &source) | ||
if reqErr != nil { | ||
return diag.FromErr(reqErr.Err) | ||
} | ||
|
||
d.SetId(req.(map[string]interface{})["uid"].(string)) | ||
return diags | ||
} | ||
|
||
func resourceAppRead(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
c := meta.(*Client) | ||
var diags diag.Diagnostics | ||
|
||
id := d.Id() | ||
url := fmt.Sprintf("%s/apps/%s", apiRoot(c.TenantId), id) | ||
|
||
req, reqErr := c.yamlRequest("GET", url, nil) | ||
if reqErr != nil { | ||
if reqErr.StatusCode == http.StatusNotFound { | ||
d.SetId("") | ||
return diags | ||
} | ||
return diag.FromErr(reqErr.Err) | ||
} | ||
|
||
response := req.(map[string]interface{}) | ||
if err := d.Set("source", response["source"].(string)); err != nil { | ||
return diag.FromErr(err) | ||
} | ||
if err := d.Set("uid", response["uid"].(string)); err != nil { | ||
return diag.FromErr(err) | ||
} | ||
|
||
return diags | ||
} | ||
|
||
func resourceAppUpdate(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
c := meta.(*Client) | ||
var diags diag.Diagnostics | ||
|
||
if d.HasChanges("source") { | ||
uid := d.Id() | ||
source := d.Get("source").(string) | ||
url := fmt.Sprintf("%s/apps/%s", apiRoot(c.TenantId), uid) | ||
|
||
_, reqErr := c.yamlRequest("PUT", url, &source) | ||
if reqErr != nil { | ||
return diag.FromErr(reqErr.Err) | ||
} | ||
|
||
return diags | ||
} | ||
return resourceAppRead(ctx, d, meta) | ||
} | ||
|
||
func resourceAppDelete(ctx context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { | ||
c := meta.(*Client) | ||
var diags diag.Diagnostics | ||
|
||
uid := d.Id() | ||
url := fmt.Sprintf("%s/apps/%s", apiRoot(c.TenantId), uid) | ||
|
||
_, reqErr := c.request("DELETE", url, nil) | ||
if reqErr != nil { | ||
return diag.FromErr(reqErr.Err) | ||
} | ||
|
||
d.SetId("") | ||
return diags | ||
} |
Oops, something went wrong.