Skip to content

Commit

Permalink
Add documentation and fix source of provider (cisco-open#12)
Browse files Browse the repository at this point in the history
Signed-off-by: Viorel Dodin <[email protected]>
  • Loading branch information
DodinViorel committed Apr 25, 2024
1 parent d413bbd commit a4f4e09
Show file tree
Hide file tree
Showing 15 changed files with 106 additions and 202 deletions.
30 changes: 0 additions & 30 deletions docs/data-sources/example.md

This file was deleted.

28 changes: 28 additions & 0 deletions docs/data-sources/type.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "observability_type Data Source - observability"
subcategory: ""
description: |-
Type data source
---

# observability_type (Data Source)

Type data source



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `type_name` (String) Specifies the fully qualified type name used to get the type

### Optional

- `data` (Dynamic) JSON schema of the returned type

### Read-Only

- `id` (String) Used to provide compatibility for testing framework
26 changes: 0 additions & 26 deletions docs/functions/example.md

This file was deleted.

20 changes: 11 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "scaffolding Provider"
page_title: "observability Provider"
subcategory: ""
description: |-
---

# scaffolding Provider
# observability Provider



## Example Usage

```terraform
provider "scaffolding" {
# example configuration here
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `auth_method` (String) Authentication type selected for observability API requests. Possible values(oauth, headless, service-principal)
- `tenant` (String) Tenant ID used to make requests to API

### Optional

- `endpoint` (String) Example provider attribute
- `password` (String, Sensitive) Password to authenticate using headless
- `secrets_file` (String) Path to secrets file to authenticate using service-principal
- `url` (String) URL used when authentication eg. <https://mytenant.com>
- `username` (String) Username to authenticate using headless
31 changes: 0 additions & 31 deletions docs/resources/example.md

This file was deleted.

32 changes: 32 additions & 0 deletions docs/resources/object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "observability_object Resource - observability"
subcategory: ""
description: |-
Object resource
---

# observability_object (Resource)

Object resource



<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `layer_id` (String) Specifies the layer ID where the object resides
- `layer_type` (String) Specifies the layer type where the object resides
- `type_name` (String) Specifies the fully qualified type name used to get the type

### Optional

- `data` (String) JSON schema of the returned object
- `import_id` (String) ID used when doing import operation on an object
- `object_id` (String) Spepcified the object ID for the particular object to get

### Read-Only

- `id` (String) Used to provide compatibility for testing framework
21 changes: 1 addition & 20 deletions examples/data-sources/cop_example/data-source.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,7 @@
#
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
observability = {
source = "testTerraform.com/appd/observability"
}
}
}

provider "observability" {
tenant="0eb4e853-34fb-4f77-b3fc-b9cd3b462366"
auth_method="service-principal"
url="https://aiops-dev.saas.appd-test.com"
secrets_file="/home/vdodin/aiops_secret.json"
}


data "observability_type" "ns" {
type_name = "fmm:namespace"
}

output "myType" {
value = data.observability_type.ns
}
}
8 changes: 4 additions & 4 deletions examples/provider/provider_oauth.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
terraform {
required_providers {
observability = {
source = "testTerraform.com/appd/observability"
source = "registry.terraform.io/cisco-open/observability"
}
}
}

provider "observability" {
tenant="47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
auth_method="oauth"
url="https://alameda-c0-test-02.saas.appd-test.com"
tenant = "47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
auth_method = "oauth"
url = "https://alameda-c0-test-02.saas.appd-test.com"
}

10 changes: 5 additions & 5 deletions examples/provider/provider_service_principal.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@
terraform {
required_providers {
observability = {
source = "testTerraform.com/appd/observability"
source = "registry.terraform.io/cisco-open/observability"
}
}
}

provider "observability" {
tenant="47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
auth_method="service-principal"
url="https://alameda-c0-test-02.saas.appd-test.com"
secrets_file="/home/vdodin/secrets.json"
tenant = "47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
auth_method = "service-principal"
url = "https://alameda-c0-test-02.saas.appd-test.com"
secrets_file = "/home/yourUser/secrets.json"
}

36 changes: 18 additions & 18 deletions examples/resources/cop_example/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@
#
# SPDX-License-Identifier: MPL-2.0

terraform {
required_providers {
observability = {
source = "testTerraform.com/appd/observability"
}
}
}

provider "observability" {
tenant = "47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
auth_method = "oauth"
url = "https://alameda-c0-test-02.saas.appd-test.com"
}

resource "observability_object" "ns" {
type_name = "fmm:namespace"
object_id = "aws"
resource "observability_object" "conn" {
type_name = "anzen:cloudConnection"
object_id = "just-terraform-testing"
layer_type = "TENANT"
layer_id = "47a01df9-54a0-472b-96b8-7c8f64eb7cbf"
layer_id = "0eb4e853-34fb-4f77-b3fc-b9cd3b462366"
import_id = "anzen:cloudConnection|just-terraform-testing|TENANT|0eb4e853-34fb-4f77-b3fc-b9cd3b462366"
data = jsonencode(
{
"cloudType" : "AWS",
"connectionName" : "just-terraform-testing",
"region" : "us-east-2",
"accessKey" : "**********",
"secretAccessKey" : "**********",
"s3AccessLogBucket" : "s3://s3-sanity-logging/",
"athenaOutputBucket" : "s3://s3-sanity-athena-logs/",
"createTimestamp" : "",
"accountId" : "81892134343434"
}
)
}
50 changes: 0 additions & 50 deletions internal/provider/example_function.go

This file was deleted.

1 change: 1 addition & 0 deletions internal/provider/object_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (r *ObjectResource) Metadata(_ context.Context, req resource.MetadataReques
resp.TypeName = req.ProviderTypeName + "_object"
}

// Schema defines the schema for the resource.
func (r *ObjectResource) Schema(_ context.Context, _ resource.SchemaRequest, resp *resource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
Expand Down
7 changes: 3 additions & 4 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (p *COPProvider) Metadata(_ context.Context, _ provider.MetadataRequest, re
resp.Version = p.version
}

// Schema defines the provider-level schema for configuration data.
func (p *COPProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *provider.SchemaResponse) {
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
Expand All @@ -66,7 +67,7 @@ func (p *COPProvider) Schema(_ context.Context, _ provider.SchemaRequest, resp *
Sensitive: true,
},
"url": schema.StringAttribute{
MarkdownDescription: "URL used when authentication eg. https://mytenant.com",
MarkdownDescription: "URL used when authentication eg. <https://mytenant.com>",
Optional: true,
},
"secrets_file": schema.StringAttribute{
Expand Down Expand Up @@ -276,9 +277,7 @@ func (p *COPProvider) DataSources(_ context.Context) []func() datasource.DataSou
}

func (p *COPProvider) Functions(_ context.Context) []func() function.Function {
return []func() function.Function{
NewExampleFunction,
}
return []func() function.Function{}
}

func New(version string) func() provider.Provider {
Expand Down
1 change: 1 addition & 0 deletions internal/provider/type_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func (d *TypeDataSource) Metadata(_ context.Context, req datasource.MetadataRequ
resp.TypeName = req.ProviderTypeName + "_type"
}

// Schema defines the schema for the data source.
func (d *TypeDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) {
resp.Schema = schema.Schema{
// This description is used by the documentation generator and the language server.
Expand Down
Loading

0 comments on commit a4f4e09

Please sign in to comment.