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/data-sources/type.md b/docs/data-sources/type.md new file mode 100644 index 0000000..6666788 --- /dev/null +++ b/docs/data-sources/type.md @@ -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 + +### 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 diff --git a/docs/functions/example.md b/docs/functions/example.md deleted file mode 100644 index c65087d..0000000 --- a/docs/functions/example.md +++ /dev/null @@ -1,26 +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 7458d6d..2a12fb3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -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 +### 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. +- `username` (String) Username to authenticate using headless diff --git a/docs/resources/example.md b/docs/resources/example.md deleted file mode 100644 index 5f3d5ca..0000000 --- a/docs/resources/example.md +++ /dev/null @@ -1,31 +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 diff --git a/docs/resources/object.md b/docs/resources/object.md new file mode 100644 index 0000000..92616c0 --- /dev/null +++ b/docs/resources/object.md @@ -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 + +### 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 diff --git a/examples/data-sources/cop_example/data-source.tf b/examples/data-sources/cop_example/data-source.tf index d2541fd..c1e9f2e 100644 --- a/examples/data-sources/cop_example/data-source.tf +++ b/examples/data-sources/cop_example/data-source.tf @@ -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 -} +} \ No newline at end of file diff --git a/examples/provider/provider_oauth.tf b/examples/provider/provider_oauth.tf index 604a5f8..eaacb17 100644 --- a/examples/provider/provider_oauth.tf +++ b/examples/provider/provider_oauth.tf @@ -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" } diff --git a/examples/provider/provider_service_principal.tf b/examples/provider/provider_service_principal.tf index 2872e67..5fc9d64 100644 --- a/examples/provider/provider_service_principal.tf +++ b/examples/provider/provider_service_principal.tf @@ -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" } diff --git a/examples/resources/cop_example/resource.tf b/examples/resources/cop_example/resource.tf index bd9e8ab..ef36e1b 100644 --- a/examples/resources/cop_example/resource.tf +++ b/examples/resources/cop_example/resource.tf @@ -4,39 +4,23 @@ # # 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" -} - - resource "observability_object" "conn" { - type_name = "anzen:cloudConnection" - object_id = "just-terraform-testing" + type_name = "anzen:cloudConnection" + object_id = "just-terraform-testing" layer_type = "TENANT" - layer_id = "0eb4e853-34fb-4f77-b3fc-b9cd3b462366" - import_id = "anzen:cloudConnection|just-terraform-testing|TENANT|0eb4e853-34fb-4f77-b3fc-b9cd3b462366" + 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" + "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" } ) } diff --git a/internal/provider/example_function.go b/internal/provider/example_function.go deleted file mode 100644 index dee4d08..0000000 --- a/internal/provider/example_function.go +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) HashiCorp, Inc. -// SPDX-License-Identifier: MPL-2.0 - -package provider - -import ( - "context" - - "github.com/hashicorp/terraform-plugin-framework/function" -) - -var ( - _ function.Function = ExampleFunction{} -) - -func NewExampleFunction() function.Function { - return ExampleFunction{} -} - -type ExampleFunction struct{} - -func (r ExampleFunction) Metadata(_ context.Context, _ function.MetadataRequest, resp *function.MetadataResponse) { - resp.Name = "example" -} - -func (r ExampleFunction) Definition(_ context.Context, _ function.DefinitionRequest, resp *function.DefinitionResponse) { - resp.Definition = function.Definition{ - Summary: "Example function", - MarkdownDescription: "Echoes given argument as result", - Parameters: []function.Parameter{ - function.StringParameter{ - Name: "input", - MarkdownDescription: "String to echo", - }, - }, - Return: function.StringReturn{}, - } -} - -func (r ExampleFunction) Run(ctx context.Context, req function.RunRequest, resp *function.RunResponse) { - var data string - - resp.Error = function.ConcatFuncErrors(req.Arguments.Get(ctx, &data)) - - if resp.Error != nil { - return - } - - resp.Error = function.ConcatFuncErrors(resp.Result.Set(ctx, data)) -} diff --git a/internal/provider/object_resource.go b/internal/provider/object_resource.go index 5a00105..72dcb43 100644 --- a/internal/provider/object_resource.go +++ b/internal/provider/object_resource.go @@ -47,6 +47,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. diff --git a/internal/provider/provider.go b/internal/provider/provider.go index 55f5f56..16c1114 100644 --- a/internal/provider/provider.go +++ b/internal/provider/provider.go @@ -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{ @@ -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. ", Optional: true, }, "secrets_file": schema.StringAttribute{ @@ -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 { diff --git a/internal/provider/type_data_source.go b/internal/provider/type_data_source.go index 41f5dd0..1036b0a 100644 --- a/internal/provider/type_data_source.go +++ b/internal/provider/type_data_source.go @@ -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. diff --git a/main.go b/main.go index c748457..c3d1ec4 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ import ( // Run the docs generation tool, check its repository for more information on how it works and how docs // can be customized. -//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name scaffolding +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate -provider-name observability var ( // these will be set by the goreleaser configuration @@ -42,10 +42,7 @@ func main() { flag.Parse() opts := providerserver.ServeOpts{ - // TODO: Update this string with the published name of your provider. - // Also update the tfplugindocs generate command to either remove the - // -provider-name flag or set its value to the updated provider name. - Address: "testTerraform.com/appd/observability", + Address: "registry.terraform.io/cisco-open/observability", Debug: debug, }