Skip to content

Commit

Permalink
Merge pull request #2 from Telemaco019/fix/docs
Browse files Browse the repository at this point in the history
Fix/docs
  • Loading branch information
Telemaco019 authored Dec 12, 2021
2 parents aee0e27 + 94433bf commit 9d6c67b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 106 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ backend.tfvars
.terraform.lock.hcl

.idea/

examples/tests
2 changes: 1 addition & 1 deletion docs/data-sources/datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ data "azureml_datastores" "example" {
- **last_modified_user_type** (String) The kind of user that last updated the datastore (Service Principal or User).
- **storage_account_name** (String) The name of the Storage Account to which the datastore is linked to.
- **storage_container_name** (String) The name of the Storage Container to which the datastore is linked to.
- **storage_type** (String) The type of the storage to which the datstore is linked to. Possible values are: %!v(MISSING)
- **storage_type** (String) The type of the storage to which the datstore is linked to. Possible values are: ["AzureFile" "AzureBlob" "AzureDataLakeGen1" "AzureDataLakeGen2" "AzureMySql" "AzurePostgreSql" "AzureSqlDatabase" "GlusterFs"]


43 changes: 5 additions & 38 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,49 +18,16 @@ Principal specific to Terraform.
terraform {
required_providers {
azureml = {
source = "registry.terraform.io/Telemaco019/azureml"
version = "0.0.1"
source = "registry.terraform.io/Telemaco019/azureml"
}
}
}
provider "azureml" {
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
subscription_id = var.subscription_id
}
data "azureml_datastore" "datastore" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
name = "test"
}
output "datastore" {
value = data.azureml_datastore.datastore
}
data "azureml_datastores" "datastores" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
}
resource "azureml_datastore" "example" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
name = "example2"
description = "example"
storage_type = "AzureBlob"
storage_account_name = "pippo"
storage_container_name = "example"
auth {
credentials_type = "ServicePrincipal"
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
}
client_id = ""
client_secret = ""
tenant_id = ""
subscription_id = ""
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/datastore.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ resource "azureml_datastore" "example" {
- **auth** (Block Set, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--auth))
- **name** (String) The name of the datastore.
- **resource_group_name** (String) The name of the resource group of the Azure ML Workspace to which the datastore belongs to.
- **storage_type** (String) The type of the storage to which the datstore is linked to. Possible values are: %!v(MISSING)
- **storage_type** (String) The type of the storage to which the datstore is linked to. Possible values are: ["AzureFile" "AzureBlob" "AzureDataLakeGen1" "AzureDataLakeGen2" "AzureMySql" "AzurePostgreSql" "AzureSqlDatabase" "GlusterFs"]
- **workspace_name** (String) The name of the Azure ML Workspace to which the datastore belongs to.

### Optional
Expand All @@ -65,7 +65,7 @@ resource "azureml_datastore" "example" {

Required:

- **credentials_type** (String) The type of credentials used for authenticating with the underlying storage. Possible values are: %!v(MISSING).
- **credentials_type** (String) The type of credentials used for authenticating with the underlying storage. Possible values are: ["AccountKey" "Certificate" "None" "Sas" "ServicePrincipal" "SqlAdmin"].

Optional:

Expand Down
43 changes: 5 additions & 38 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
@@ -1,47 +1,14 @@
terraform {
required_providers {
azureml = {
source = "registry.terraform.io/Telemaco019/azureml"
version = "0.0.1"
source = "registry.terraform.io/Telemaco019/azureml"
}
}
}

provider "azureml" {
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
subscription_id = var.subscription_id
}

data "azureml_datastore" "datastore" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
name = "test"
}
output "datastore" {
value = data.azureml_datastore.datastore
}

data "azureml_datastores" "datastores" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
}

resource "azureml_datastore" "example" {
resource_group_name = var.resource_group_name
workspace_name = var.workspace_name
name = "example2"
description = "example"
storage_type = "AzureBlob"

storage_account_name = "pippo"
storage_container_name = "example"

auth {
credentials_type = "ServicePrincipal"
client_id = var.client_id
client_secret = var.client_secret
tenant_id = var.tenant_id
}
client_id = ""
client_secret = ""
tenant_id = ""
subscription_id = ""
}
18 changes: 0 additions & 18 deletions examples/provider/required_variables.tf

This file was deleted.

27 changes: 18 additions & 9 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"github.com/Telemaco019/azureml-go-sdk/workspace"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"time"
)

Expand Down Expand Up @@ -33,21 +34,29 @@ func New(version string) func() *schema.Provider {
p := &schema.Provider{
Schema: map[string]*schema.Schema{
"client_id": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "The application ID of the Service Principal used for authenticating with Azure Machine Learning.",
},
"client_secret": {
Type: schema.TypeString,
Required: true,
Sensitive: true,
Type: schema.TypeString,
Required: true,
Sensitive: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "The client secret of the Service Principal used for authenticating with Azure Machine Learning.",
},
"tenant_id": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "The ID of the home Tenant of the Service Principal used for authenticating with Azure Machine Learning.",
},
"subscription_id": {
Type: schema.TypeString,
Required: true,
Type: schema.TypeString,
Required: true,
ValidateFunc: validation.StringIsNotEmpty,
Description: "The Azure subscription ID on which the provider will operate.",
},
},
DataSourcesMap: map[string]*schema.Resource{
Expand Down

0 comments on commit 9d6c67b

Please sign in to comment.