diff --git a/pkg/sdkv2/data_sources/azure_dev_ops_project.go b/pkg/sdkv2/data_sources/azure_dev_ops_project.go index 0b4c1e3..015ec2b 100644 --- a/pkg/sdkv2/data_sources/azure_dev_ops_project.go +++ b/pkg/sdkv2/data_sources/azure_dev_ops_project.go @@ -9,17 +9,17 @@ import ( ) var azureDevOpsProjectSchema = map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, Description: "The internal Azure Dev Ops ID of the ADO Project", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "The name of the ADO project", }, - "url": &schema.Schema{ + "url": { Type: schema.TypeString, Computed: true, Description: "The URL of the ADO project", diff --git a/pkg/sdkv2/data_sources/azure_dev_ops_repository.go b/pkg/sdkv2/data_sources/azure_dev_ops_repository.go index 550c8a3..cdd354d 100644 --- a/pkg/sdkv2/data_sources/azure_dev_ops_repository.go +++ b/pkg/sdkv2/data_sources/azure_dev_ops_repository.go @@ -9,37 +9,37 @@ import ( ) var azureDevOpsRepositorySchema = map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, Description: "The internal Azure Dev Ops ID of the ADO Repository", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "The name of the ADO repository", }, - "azure_dev_ops_project_id": &schema.Schema{ + "azure_dev_ops_project_id": { Type: schema.TypeString, Required: true, Description: "The internal Azure Dev Ops ID of the ADO Project. Can be retrieved using the data source dbtcloud_azure_dev_ops_project and the project name", }, - "details_url": &schema.Schema{ + "details_url": { Type: schema.TypeString, Computed: true, Description: "The URL of the ADO repository showing details about the repository and its attributes", }, - "remote_url": &schema.Schema{ + "remote_url": { Type: schema.TypeString, Computed: true, Description: "The HTTP URL of the ADO repository used to connect to dbt Cloud", }, - "web_url": &schema.Schema{ + "web_url": { Type: schema.TypeString, Computed: true, Description: "The URL of the ADO repository accessible in the browser", }, - "default_branch": &schema.Schema{ + "default_branch": { Type: schema.TypeString, Computed: true, Description: "The default branch of the ADO repository", diff --git a/pkg/sdkv2/data_sources/bigquery_connection.go b/pkg/sdkv2/data_sources/bigquery_connection.go index 1db9ad2..496434d 100644 --- a/pkg/sdkv2/data_sources/bigquery_connection.go +++ b/pkg/sdkv2/data_sources/bigquery_connection.go @@ -11,123 +11,123 @@ import ( ) var bigQueryConnectionSchema = map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Required: true, Description: "Connection Identifier", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the connection in", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the connection is active", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Description: "Connection name", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Computed: true, Description: "The type of connection", }, // field in details - "gcp_project_id": &schema.Schema{ + "gcp_project_id": { Type: schema.TypeString, Computed: true, Description: "GCP project ID", }, - "timeout_seconds": &schema.Schema{ + "timeout_seconds": { Type: schema.TypeInt, Computed: true, Description: "Timeout in seconds for queries", }, - "private_key_id": &schema.Schema{ + "private_key_id": { Type: schema.TypeString, Computed: true, Description: "Private key ID of the Service Account", }, - "private_key": &schema.Schema{ + "private_key": { Type: schema.TypeString, Computed: true, Description: "Private key of the Service Account", }, - "client_email": &schema.Schema{ + "client_email": { Type: schema.TypeString, Computed: true, Description: "Service Account email", }, - "client_id": &schema.Schema{ + "client_id": { Type: schema.TypeString, Computed: true, Description: "Client ID of the Service Account", }, - "auth_uri": &schema.Schema{ + "auth_uri": { Type: schema.TypeString, Computed: true, Description: "Auth URI for the Service Account", }, - "token_uri": &schema.Schema{ + "token_uri": { Type: schema.TypeString, Computed: true, Description: "Token URI for the Service Account", }, - "auth_provider_x509_cert_url": &schema.Schema{ + "auth_provider_x509_cert_url": { Type: schema.TypeString, Computed: true, Description: "Auth Provider X509 Cert URL for the Service Account", }, - "client_x509_cert_url": &schema.Schema{ + "client_x509_cert_url": { Type: schema.TypeString, Computed: true, Description: "Client X509 Cert URL for the Service Account", }, - "retries": &schema.Schema{ + "retries": { Type: schema.TypeInt, Computed: true, Description: "Number of retries for queries", }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Computed: true, Description: "Location to create new Datasets in", }, - "maximum_bytes_billed": &schema.Schema{ + "maximum_bytes_billed": { Type: schema.TypeInt, Computed: true, Description: "Max number of bytes that can be billed for a given BigQuery query", }, - "execution_project": &schema.Schema{ + "execution_project": { Type: schema.TypeString, Computed: true, Description: "Project to bill for query execution", }, - "priority": &schema.Schema{ + "priority": { Type: schema.TypeString, Computed: true, Description: "The priority with which to execute BigQuery queries", }, - "gcs_bucket": &schema.Schema{ + "gcs_bucket": { Type: schema.TypeString, Computed: true, Description: "URI for a Google Cloud Storage bucket to host Python code executed via Datapro", }, - "dataproc_region": &schema.Schema{ + "dataproc_region": { Type: schema.TypeString, Computed: true, Description: "Google Cloud region for PySpark workloads on Dataproc", }, - "dataproc_cluster_name": &schema.Schema{ + "dataproc_cluster_name": { Type: schema.TypeString, Computed: true, Description: "Dataproc cluster name for PySpark workloads", }, - "is_configured_for_oauth": &schema.Schema{ + "is_configured_for_oauth": { Type: schema.TypeBool, Computed: true, Description: "Whether the connection is configured for OAuth or not", diff --git a/pkg/sdkv2/data_sources/bigquery_credential.go b/pkg/sdkv2/data_sources/bigquery_credential.go index 85b9f43..841ebb1 100644 --- a/pkg/sdkv2/data_sources/bigquery_credential.go +++ b/pkg/sdkv2/data_sources/bigquery_credential.go @@ -10,27 +10,27 @@ import ( ) var bigqueryCredentialSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Required: true, Description: "Credential ID", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the BigQuery credential is active", }, - "dataset": &schema.Schema{ + "dataset": { Type: schema.TypeString, Computed: true, Description: "Default dataset name", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Computed: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/data_sources/connection.go b/pkg/sdkv2/data_sources/connection.go index 4d79e0d..6ce486c 100644 --- a/pkg/sdkv2/data_sources/connection.go +++ b/pkg/sdkv2/data_sources/connection.go @@ -11,62 +11,62 @@ import ( ) var connectionSchema = map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Required: true, Description: "ID for the connection", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the connection in", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the connection is active", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Description: "Connection name", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Computed: true, Description: "Connection type", }, - "private_link_endpoint_id": &schema.Schema{ + "private_link_endpoint_id": { Type: schema.TypeString, Computed: true, Description: "The ID of the PrivateLink connection", }, - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Computed: true, Description: "Account for the connection", }, - "database": &schema.Schema{ + "database": { Type: schema.TypeString, Computed: true, Description: "Database name for the connection", }, - "warehouse": &schema.Schema{ + "warehouse": { Type: schema.TypeString, Computed: true, Description: "Warehouse name for the connection", }, - "role": &schema.Schema{ + "role": { Type: schema.TypeString, Computed: true, Description: "Role name for the connection", }, - "allow_sso": &schema.Schema{ + "allow_sso": { Type: schema.TypeBool, Computed: true, Description: "Flag for whether or not to use SSO for the connection", }, - "allow_keep_alive": &schema.Schema{ + "allow_keep_alive": { Type: schema.TypeBool, Computed: true, Description: "Flag for whether or not to use the keep session alive parameter in the connection", diff --git a/pkg/sdkv2/data_sources/databricks_credential.go b/pkg/sdkv2/data_sources/databricks_credential.go index cd8a6ef..91efbe3 100644 --- a/pkg/sdkv2/data_sources/databricks_credential.go +++ b/pkg/sdkv2/data_sources/databricks_credential.go @@ -10,37 +10,37 @@ import ( ) var databricksCredentialSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Required: true, Description: "Credential ID", }, - "adapter_id": &schema.Schema{ + "adapter_id": { Type: schema.TypeInt, Computed: true, Description: "Databricks adapter ID for the credential", }, - "target_name": &schema.Schema{ + "target_name": { Type: schema.TypeString, Computed: true, Description: "Target name", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Computed: true, Description: "Number of threads to use", }, - "catalog": &schema.Schema{ + "catalog": { Type: schema.TypeString, Computed: true, Description: "The catalog where to create models", }, - "schema": &schema.Schema{ + "schema": { Type: schema.TypeString, Computed: true, Description: "The schema where to create models", diff --git a/pkg/sdkv2/data_sources/environment_variable.go b/pkg/sdkv2/data_sources/environment_variable.go index 07de1a1..8700535 100644 --- a/pkg/sdkv2/data_sources/environment_variable.go +++ b/pkg/sdkv2/data_sources/environment_variable.go @@ -10,17 +10,17 @@ import ( ) var environmentVariableSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID the variable exists in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Name for the variable", }, - "environment_values": &schema.Schema{ + "environment_values": { Type: schema.TypeMap, Computed: true, Description: "Map containing the environment variables", diff --git a/pkg/sdkv2/data_sources/extended_attributes.go b/pkg/sdkv2/data_sources/extended_attributes.go index 7ac9826..7a0095a 100644 --- a/pkg/sdkv2/data_sources/extended_attributes.go +++ b/pkg/sdkv2/data_sources/extended_attributes.go @@ -10,22 +10,22 @@ import ( ) var extendedAttributesSchema = map[string]*schema.Schema{ - "extended_attributes_id": &schema.Schema{ + "extended_attributes_id": { Type: schema.TypeInt, Required: true, Description: "ID of the extended attributes", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID the extended attributes refers to", }, - "state": &schema.Schema{ + "state": { Type: schema.TypeInt, Computed: true, Description: "The state of the extended attributes (1 = active, 2 = inactive)", }, - "extended_attributes": &schema.Schema{ + "extended_attributes": { Type: schema.TypeString, Computed: true, Description: "A JSON string listing the extended attributes mapping", diff --git a/pkg/sdkv2/data_sources/group_users.go b/pkg/sdkv2/data_sources/group_users.go index 1a8c720..0c5fc46 100644 --- a/pkg/sdkv2/data_sources/group_users.go +++ b/pkg/sdkv2/data_sources/group_users.go @@ -10,12 +10,12 @@ import ( ) var groupUsersSchema = map[string]*schema.Schema{ - "group_id": &schema.Schema{ + "group_id": { Type: schema.TypeInt, Required: true, Description: "ID of the group", }, - "users": &schema.Schema{ + "users": { Type: schema.TypeSet, Computed: true, Description: "List of users (map of ID and email) in the group", diff --git a/pkg/sdkv2/data_sources/job.go b/pkg/sdkv2/data_sources/job.go index 0e7836c..1a37e35 100644 --- a/pkg/sdkv2/data_sources/job.go +++ b/pkg/sdkv2/data_sources/job.go @@ -13,47 +13,47 @@ import ( ) var jobSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "ID of the project the job is in", }, - "environment_id": &schema.Schema{ + "environment_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the environment the job is in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Description: "Given name for the job", }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, Description: "Long description for the job", }, - "job_id": &schema.Schema{ + "job_id": { Type: schema.TypeInt, Required: true, Description: "ID of the job", }, - "deferring_job_id": &schema.Schema{ + "deferring_job_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the job this job defers to", }, - "deferring_environment_id": &schema.Schema{ + "deferring_environment_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the environment this job defers to", }, - "self_deferring": &schema.Schema{ + "self_deferring": { Type: schema.TypeBool, Computed: true, Description: "Whether this job defers on a previous run of itself (overrides value in deferring_job_id)", }, - "triggers": &schema.Schema{ + "triggers": { Type: schema.TypeMap, Computed: true, Elem: &schema.Schema{ @@ -63,17 +63,17 @@ var jobSchema = map[string]*schema.Schema{ }, Description: "Flags for which types of triggers to use, keys of github_webhook, git_provider_webhook, schedule, on_merge", }, - "timeout_seconds": &schema.Schema{ + "timeout_seconds": { Type: schema.TypeInt, Computed: true, Description: "Number of seconds before the job times out", }, - "triggers_on_draft_pr": &schema.Schema{ + "triggers_on_draft_pr": { Type: schema.TypeBool, Computed: true, Description: "Whether the CI job should be automatically triggered on draft PRs", }, - "job_completion_trigger_condition": &schema.Schema{ + "job_completion_trigger_condition": { Type: schema.TypeSet, Computed: true, Elem: &schema.Resource{ diff --git a/pkg/sdkv2/data_sources/postgres_credential.go b/pkg/sdkv2/data_sources/postgres_credential.go index 0531d76..a5f5b08 100644 --- a/pkg/sdkv2/data_sources/postgres_credential.go +++ b/pkg/sdkv2/data_sources/postgres_credential.go @@ -10,32 +10,32 @@ import ( ) var postgresCredentialSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Required: true, Description: "Credential ID", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the Postgres credential is active", }, - "default_schema": &schema.Schema{ + "default_schema": { Type: schema.TypeString, Computed: true, Description: "Default schema name", }, - "username": &schema.Schema{ + "username": { Type: schema.TypeString, Computed: true, Description: "Username for Postgres", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Computed: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/data_sources/privatelink_endpoint.go b/pkg/sdkv2/data_sources/privatelink_endpoint.go index c7a974f..86b1c06 100644 --- a/pkg/sdkv2/data_sources/privatelink_endpoint.go +++ b/pkg/sdkv2/data_sources/privatelink_endpoint.go @@ -9,34 +9,34 @@ import ( ) var privatelinkEndpointSchema = map[string]*schema.Schema{ - "id": &schema.Schema{ + "id": { Type: schema.TypeString, Computed: true, Description: "The internal ID of the PrivateLink Endpoint", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Optional: true, Default: "", Description: "Given descriptive name for the PrivateLink Endpoint (name and/or private_link_endpoint_url need to be provided to return data for the datasource)", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Computed: true, Description: "Type of the PrivateLink Endpoint", }, - "private_link_endpoint_url": &schema.Schema{ + "private_link_endpoint_url": { Type: schema.TypeString, Optional: true, Default: "", Description: "The URL of the PrivateLink Endpoint (private_link_endpoint_url and/or name need to be provided to return data for the datasource)", }, - "cidr_range": &schema.Schema{ + "cidr_range": { Type: schema.TypeString, Computed: true, Description: "The CIDR range of the PrivateLink Endpoint", }, - "state": &schema.Schema{ + "state": { Type: schema.TypeInt, Computed: true, Description: "PrivatelinkEndpoint state should be 1 = active, as 2 = deleted", diff --git a/pkg/sdkv2/data_sources/project.go b/pkg/sdkv2/data_sources/project.go index f21c087..d26fc8d 100644 --- a/pkg/sdkv2/data_sources/project.go +++ b/pkg/sdkv2/data_sources/project.go @@ -11,38 +11,38 @@ import ( ) var projectSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Optional: true, Description: "ID of the project to represent", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Optional: true, Description: "Given name for project", }, - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the connection associated with the project", }, - "repository_id": &schema.Schema{ + "repository_id": { Type: schema.TypeInt, Computed: true, Description: "ID of the repository associated with the project", }, - "freshness_job_id": &schema.Schema{ + "freshness_job_id": { Type: schema.TypeInt, Computed: true, Description: "ID of Job for source freshness", }, - "docs_job_id": &schema.Schema{ + "docs_job_id": { Type: schema.TypeInt, Computed: true, Description: "ID of Job for the documentation", }, - "state": &schema.Schema{ + "state": { Type: schema.TypeInt, Computed: true, Description: "Project state should be 1 = active, as 2 = deleted", diff --git a/pkg/sdkv2/data_sources/repository.go b/pkg/sdkv2/data_sources/repository.go index 97eb04f..c48dc3f 100644 --- a/pkg/sdkv2/data_sources/repository.go +++ b/pkg/sdkv2/data_sources/repository.go @@ -11,54 +11,54 @@ import ( ) var repositorySchema = map[string]*schema.Schema{ - "repository_id": &schema.Schema{ + "repository_id": { Type: schema.TypeInt, Required: true, Description: "ID for the repository", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the repository in", }, - "fetch_deploy_key": &schema.Schema{ + "fetch_deploy_key": { Type: schema.TypeBool, Optional: true, Default: false, Deprecated: "This field is deprecated and will be removed in a future version of the provider. The key is always fetched when the clone strategy is `deploy_key`", Description: "Whether we should return the public deploy key", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the repository is active", }, - "remote_url": &schema.Schema{ + "remote_url": { Type: schema.TypeString, Computed: true, Description: "Connection name", }, - "git_clone_strategy": &schema.Schema{ + "git_clone_strategy": { Type: schema.TypeString, Computed: true, Description: "Git clone strategy for the repository", }, - "repository_credentials_id": &schema.Schema{ + "repository_credentials_id": { Type: schema.TypeInt, Computed: true, Description: "Credentials ID for the repository (From the repository side not the dbt Cloud ID)", }, - "gitlab_project_id": &schema.Schema{ + "gitlab_project_id": { Type: schema.TypeInt, Computed: true, Description: "Identifier for the Gitlab project", }, - "github_installation_id": &schema.Schema{ + "github_installation_id": { Type: schema.TypeInt, Computed: true, Description: "Identifier for the GitHub installation", }, - "deploy_key": &schema.Schema{ + "deploy_key": { Type: schema.TypeString, Computed: true, Description: "Public key generated by dbt when using `deploy_key` clone strategy", diff --git a/pkg/sdkv2/data_sources/snowflake_credential.go b/pkg/sdkv2/data_sources/snowflake_credential.go index d59898a..c6000a9 100644 --- a/pkg/sdkv2/data_sources/snowflake_credential.go +++ b/pkg/sdkv2/data_sources/snowflake_credential.go @@ -10,37 +10,37 @@ import ( ) var snowflakeCredentialSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Required: true, Description: "Credential ID", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Computed: true, Description: "Whether the Snowflake credential is active", }, - "auth_type": &schema.Schema{ + "auth_type": { Type: schema.TypeString, Computed: true, Description: "The type of Snowflake credential ('password' or 'keypair')", }, - "schema": &schema.Schema{ + "schema": { Type: schema.TypeString, Computed: true, Description: "Default schema name", }, - "user": &schema.Schema{ + "user": { Type: schema.TypeString, Computed: true, Description: "Username for Snowflake", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Computed: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/data_sources/user_groups.go b/pkg/sdkv2/data_sources/user_groups.go index a1a5cc3..d9076fb 100644 --- a/pkg/sdkv2/data_sources/user_groups.go +++ b/pkg/sdkv2/data_sources/user_groups.go @@ -10,12 +10,12 @@ import ( ) var userGroupsSchema = map[string]*schema.Schema{ - "user_id": &schema.Schema{ + "user_id": { Type: schema.TypeInt, Required: true, Description: "ID of the user", }, - "group_ids": &schema.Schema{ + "group_ids": { Type: schema.TypeSet, Computed: true, Description: "IDs of the groups assigned to the user", diff --git a/pkg/sdkv2/data_sources/webhook.go b/pkg/sdkv2/data_sources/webhook.go index e1d1649..287fae2 100644 --- a/pkg/sdkv2/data_sources/webhook.go +++ b/pkg/sdkv2/data_sources/webhook.go @@ -10,27 +10,27 @@ import ( ) var webhookSchema = map[string]*schema.Schema{ - "webhook_id": &schema.Schema{ + "webhook_id": { Type: schema.TypeString, Required: true, Description: "Webhooks ID", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Computed: true, Description: "Webhooks Name", }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Computed: true, Description: "Webhooks Description", }, - "client_url": &schema.Schema{ + "client_url": { Type: schema.TypeString, Computed: true, Description: "Webhooks Client URL", }, - "event_types": &schema.Schema{ + "event_types": { Type: schema.TypeList, Computed: true, Description: "Webhooks Event Types", @@ -38,7 +38,7 @@ var webhookSchema = map[string]*schema.Schema{ Type: schema.TypeString, }, }, - "job_ids": &schema.Schema{ + "job_ids": { Type: schema.TypeList, Computed: true, Description: "List of job IDs to trigger the webhook", @@ -46,17 +46,17 @@ var webhookSchema = map[string]*schema.Schema{ Type: schema.TypeInt, }, }, - "active": &schema.Schema{ + "active": { Type: schema.TypeBool, Computed: true, Description: "Webhooks active flag", }, - "http_status_code": &schema.Schema{ + "http_status_code": { Type: schema.TypeString, Computed: true, Description: "Webhooks HTTP Status Code", }, - "account_identifier": &schema.Schema{ + "account_identifier": { Type: schema.TypeString, Computed: true, Description: "Webhooks Account Identifier", diff --git a/pkg/sdkv2/resources/bigquery_connection.go b/pkg/sdkv2/resources/bigquery_connection.go index cbbe7d7..97ece7c 100644 --- a/pkg/sdkv2/resources/bigquery_connection.go +++ b/pkg/sdkv2/resources/bigquery_connection.go @@ -25,142 +25,142 @@ func ResourceBigQueryConnection() *schema.Resource { Description: "Resource to create BigQuery connections in dbt Cloud. Can be set to use OAuth for developers.", Schema: map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Computed: true, Description: "Connection Identifier", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the connection is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the connection in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Connection name", }, // TODO auto-add type - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Description: "The type of connection", ValidateFunc: validation.StringInSlice(connectionTypes, false), }, // under details - "gcp_project_id": &schema.Schema{ + "gcp_project_id": { Type: schema.TypeString, Required: true, Description: "GCP project ID", }, - "timeout_seconds": &schema.Schema{ + "timeout_seconds": { Type: schema.TypeInt, Required: true, Description: "Timeout in seconds for queries", }, - "private_key_id": &schema.Schema{ + "private_key_id": { Type: schema.TypeString, Required: true, Description: "Private key ID of the Service Account", }, - "private_key": &schema.Schema{ + "private_key": { Type: schema.TypeString, Required: true, Sensitive: true, Description: "Private key of the Service Account", }, - "client_email": &schema.Schema{ + "client_email": { Type: schema.TypeString, Required: true, Description: "Service Account email", }, - "client_id": &schema.Schema{ + "client_id": { Type: schema.TypeString, Required: true, Description: "Client ID of the Service Account", }, - "auth_uri": &schema.Schema{ + "auth_uri": { Type: schema.TypeString, Required: true, Description: "Auth URI for the Service Account", }, - "token_uri": &schema.Schema{ + "token_uri": { Type: schema.TypeString, Required: true, Description: "Token URI for the Service Account", }, - "auth_provider_x509_cert_url": &schema.Schema{ + "auth_provider_x509_cert_url": { Type: schema.TypeString, Required: true, Description: "Auth Provider X509 Cert URL for the Service Account", }, - "client_x509_cert_url": &schema.Schema{ + "client_x509_cert_url": { Type: schema.TypeString, Required: true, Description: "Client X509 Cert URL for the Service Account", }, - "retries": &schema.Schema{ + "retries": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "Number of retries for queries", }, - "location": &schema.Schema{ + "location": { Type: schema.TypeString, Optional: true, Description: "Location to create new Datasets in", }, - "maximum_bytes_billed": &schema.Schema{ + "maximum_bytes_billed": { Type: schema.TypeInt, Optional: true, Description: "Max number of bytes that can be billed for a given BigQuery query", }, - "execution_project": &schema.Schema{ + "execution_project": { Type: schema.TypeString, Optional: true, Description: "Project to bill for query execution", }, - "priority": &schema.Schema{ + "priority": { Type: schema.TypeString, Optional: true, Description: "The priority with which to execute BigQuery queries (batch or interactive)", ValidateFunc: validation.StringInSlice(bigQueryPriorities, false), }, - "gcs_bucket": &schema.Schema{ + "gcs_bucket": { Type: schema.TypeString, Optional: true, Description: "URI for a Google Cloud Storage bucket to host Python code executed via Datapro", }, - "dataproc_region": &schema.Schema{ + "dataproc_region": { Type: schema.TypeString, Optional: true, Description: "Google Cloud region for PySpark workloads on Dataproc", }, - "dataproc_cluster_name": &schema.Schema{ + "dataproc_cluster_name": { Type: schema.TypeString, Optional: true, Description: "Dataproc cluster name for PySpark workloads", }, - "application_secret": &schema.Schema{ + "application_secret": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "The Application Secret for BQ OAuth", }, - "application_id": &schema.Schema{ + "application_id": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "The Application ID for BQ OAuth", }, - "is_configured_for_oauth": &schema.Schema{ + "is_configured_for_oauth": { Type: schema.TypeBool, Computed: true, Description: "Whether the connection is configured for OAuth or not", diff --git a/pkg/sdkv2/resources/bigquery_credential.go b/pkg/sdkv2/resources/bigquery_credential.go index 4527203..ea43cc2 100644 --- a/pkg/sdkv2/resources/bigquery_credential.go +++ b/pkg/sdkv2/resources/bigquery_credential.go @@ -19,29 +19,29 @@ func ResourceBigQueryCredential() *schema.Resource { DeleteContext: resourceBigQueryCredentialDelete, Schema: map[string]*schema.Schema{ - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the BigQuery credential is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the BigQuery credential in", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Computed: true, Description: "The system BigQuery credential ID", }, - "dataset": &schema.Schema{ + "dataset": { Type: schema.TypeString, Required: true, Description: "Default dataset name", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Required: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/resources/connection.go b/pkg/sdkv2/resources/connection.go index a6fc930..c3a488e 100644 --- a/pkg/sdkv2/resources/connection.go +++ b/pkg/sdkv2/resources/connection.go @@ -38,116 +38,116 @@ func ResourceConnection() *schema.Resource { Description: docs, Schema: map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Computed: true, Description: "Connection Identifier", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the connection is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the connection in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Connection name", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Description: "The type of connection", ValidateFunc: validation.StringInSlice(connectionTypes, false), ForceNew: true, }, - "private_link_endpoint_id": &schema.Schema{ + "private_link_endpoint_id": { Type: schema.TypeString, Optional: true, Default: nil, Description: "The ID of the PrivateLink connection. This ID can be found using the `privatelink_endpoint` data source", }, - "account": &schema.Schema{ + "account": { Type: schema.TypeString, Optional: true, Description: "Account name for the connection (for Snowflake)", ConflictsWith: []string{"host_name"}, }, - "host_name": &schema.Schema{ + "host_name": { Type: schema.TypeString, Optional: true, Description: "Host name for the connection, including Databricks cluster", ConflictsWith: []string{"account"}, }, - "port": &schema.Schema{ + "port": { Type: schema.TypeInt, Optional: true, Default: nil, Description: "Port number to connect via", }, - "database": &schema.Schema{ + "database": { Type: schema.TypeString, Required: true, Description: "Database name for the connection", }, - "warehouse": &schema.Schema{ + "warehouse": { Type: schema.TypeString, Optional: true, Description: "Warehouse name for the connection (for Snowflake)", }, - "role": &schema.Schema{ + "role": { Type: schema.TypeString, Optional: true, Default: "", Description: "Role name for the connection (for Snowflake)", }, - "allow_sso": &schema.Schema{ + "allow_sso": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether or not the connection should allow SSO (for Snowflake)", }, - "allow_keep_alive": &schema.Schema{ + "allow_keep_alive": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether or not the connection should allow client session keep alive (for Snowflake)", }, - "oauth_client_id": &schema.Schema{ + "oauth_client_id": { Type: schema.TypeString, Optional: true, Default: "", Description: "OAuth client identifier (for Snowflake and Databricks)", }, - "oauth_client_secret": &schema.Schema{ + "oauth_client_secret": { Type: schema.TypeString, Optional: true, Default: "", Description: "OAuth client secret (for Snowflake and Databricks)", }, - "tunnel_enabled": &schema.Schema{ + "tunnel_enabled": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether or not tunneling should be enabled on your database connection", }, - "http_path": &schema.Schema{ + "http_path": { Type: schema.TypeString, Optional: true, Description: "The HTTP path of the Databricks cluster or SQL warehouse (for Databricks)", }, - "catalog": &schema.Schema{ + "catalog": { Type: schema.TypeString, Optional: true, Description: "Catalog name if Unity Catalog is enabled in your Databricks workspace (for Databricks)", }, - "adapter_id": &schema.Schema{ + "adapter_id": { Type: schema.TypeInt, Computed: true, Description: "Adapter id created for the Databricks connection (for Databricks)", diff --git a/pkg/sdkv2/resources/databricks_credential.go b/pkg/sdkv2/resources/databricks_credential.go index b702f80..97868d0 100644 --- a/pkg/sdkv2/resources/databricks_credential.go +++ b/pkg/sdkv2/resources/databricks_credential.go @@ -27,46 +27,46 @@ func ResourceDatabricksCredential() *schema.Resource { DeleteContext: resourceDatabricksCredentialDelete, Schema: map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the Databricks credential in", }, - "adapter_id": &schema.Schema{ + "adapter_id": { Type: schema.TypeInt, Required: true, Description: "Databricks adapter ID for the credential", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Computed: true, Description: "The system Databricks credential ID", }, - "target_name": &schema.Schema{ + "target_name": { Type: schema.TypeString, Optional: true, Default: "default", Description: "Target name", }, - "token": &schema.Schema{ + "token": { Type: schema.TypeString, Required: true, Sensitive: true, Description: "Token for Databricks user", }, - "catalog": &schema.Schema{ + "catalog": { Type: schema.TypeString, Optional: true, Default: "", Description: "The catalog where to create models (only for the databricks adapter)", }, - "schema": &schema.Schema{ + "schema": { Type: schema.TypeString, Required: true, Description: "The schema where to create models", }, - "adapter_type": &schema.Schema{ + "adapter_type": { Type: schema.TypeString, Required: true, Description: "The type of the adapter (databricks or spark)", diff --git a/pkg/sdkv2/resources/environment.go b/pkg/sdkv2/resources/environment.go index 3ce31e8..682a440 100644 --- a/pkg/sdkv2/resources/environment.go +++ b/pkg/sdkv2/resources/environment.go @@ -19,34 +19,34 @@ func ResourceEnvironment() *schema.Resource { DeleteContext: resourceEnvironmentDelete, Schema: map[string]*schema.Schema{ - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the environment is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the environment in", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Optional: true, Default: nil, Description: "Credential ID to create the environment with. A credential is not required for development environments but is required for deployment environments", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Environment name", }, - "dbt_version": &schema.Schema{ + "dbt_version": { Type: schema.TypeString, Required: true, Description: "Version number of dbt to use in this environment. It needs to be in the format `major.minor.0-latest` (e.g. `1.5.0-latest`), `major.minor.0-pre` or `versionless`. In a future version of the provider `versionless` will be the default if no version is provided", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Description: "The type of environment (must be either development or deployment)", @@ -70,30 +70,30 @@ func ResourceEnvironment() *schema.Resource { return }, }, - "use_custom_branch": &schema.Schema{ + "use_custom_branch": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether to use a custom git branch in this environment", }, - "custom_branch": &schema.Schema{ + "custom_branch": { Type: schema.TypeString, Optional: true, Default: "", Description: "Which custom branch to use in this environment", }, - "deployment_type": &schema.Schema{ + "deployment_type": { Type: schema.TypeString, Optional: true, Default: "", Description: "The type of environment. Only valid for environments of type 'deployment' and for now can only be 'production', 'staging' or left empty for generic environments", }, - "environment_id": &schema.Schema{ + "environment_id": { Type: schema.TypeInt, Computed: true, Description: "Environment ID within the project", }, - "extended_attributes_id": &schema.Schema{ + "extended_attributes_id": { Type: schema.TypeInt, Optional: true, Description: "ID of the extended attributes for the environment", diff --git a/pkg/sdkv2/resources/environment_variable.go b/pkg/sdkv2/resources/environment_variable.go index 70a7fb6..19d88fd 100644 --- a/pkg/sdkv2/resources/environment_variable.go +++ b/pkg/sdkv2/resources/environment_variable.go @@ -18,13 +18,13 @@ func ResourceEnvironmentVariable() *schema.Resource { DeleteContext: resourceEnvironmentVariableDelete, Schema: map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project for the variable to be created in", ForceNew: true, }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, // as the name is used as the ID, we need to force a new resource if the name changes @@ -41,7 +41,7 @@ func ResourceEnvironmentVariable() *schema.Resource { return }, }, - "environment_values": &schema.Schema{ + "environment_values": { Type: schema.TypeMap, Required: true, Description: "Map from environment names to respective variable value, a special key `project` should be set for the project default variable value. This field is not set as sensitive so take precautions when using secret environment variables.", diff --git a/pkg/sdkv2/resources/environment_variable_job_override.go b/pkg/sdkv2/resources/environment_variable_job_override.go index 609449a..c7ad7ca 100644 --- a/pkg/sdkv2/resources/environment_variable_job_override.go +++ b/pkg/sdkv2/resources/environment_variable_job_override.go @@ -19,30 +19,30 @@ func ResourceEnvironmentVariableJobOverride() *schema.Resource { DeleteContext: resourceEnvironmentVariableJobOverrideDelete, Schema: map[string]*schema.Schema{ - "environment_variable_job_override_id": &schema.Schema{ + "environment_variable_job_override_id": { Type: schema.TypeInt, Computed: true, Description: "The ID of the environment variable job override", }, - "job_definition_id": &schema.Schema{ + "job_definition_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "The job ID for which the environment variable is being overridden", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, ForceNew: true, Description: "The environment variable name to override", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "The project ID for which the environment variable is being overridden", }, - "raw_value": &schema.Schema{ + "raw_value": { Type: schema.TypeString, Required: true, Description: "The value for the override of the environment variable", diff --git a/pkg/sdkv2/resources/extended_attributes.go b/pkg/sdkv2/resources/extended_attributes.go index 5824480..f56a266 100644 --- a/pkg/sdkv2/resources/extended_attributes.go +++ b/pkg/sdkv2/resources/extended_attributes.go @@ -21,23 +21,23 @@ func ResourceExtendedAttributes() *schema.Resource { DeleteContext: resourceExtendedAttributesDelete, Schema: map[string]*schema.Schema{ - "extended_attributes_id": &schema.Schema{ + "extended_attributes_id": { Type: schema.TypeInt, Computed: true, Description: "Extended Attributes ID", }, - "state": &schema.Schema{ + "state": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "Extended Attributes state (1 is active, 2 is inactive)", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the extended attributes in", }, - "extended_attributes": &schema.Schema{ + "extended_attributes": { Type: schema.TypeString, Required: true, Description: "A JSON string listing the extended attributes mapping. The keys are the connections attributes available in the `profiles.yml` for a given adapter. Any fields entered will override connection details or credentials set on the environment or project. To avoid incorrect Terraform diffs, it is recommended to create this string using `jsonencode` in your Terraform code. (see example)", diff --git a/pkg/sdkv2/resources/fabric_connection.go b/pkg/sdkv2/resources/fabric_connection.go index 6f31d8b..78c539e 100644 --- a/pkg/sdkv2/resources/fabric_connection.go +++ b/pkg/sdkv2/resources/fabric_connection.go @@ -19,57 +19,57 @@ func ResourceFabricConnection() *schema.Resource { Description: "Resource to create Microsoft Fabric connections in dbt Cloud", Schema: map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Computed: true, Description: "Connection Identifier", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the connection in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Connection name", }, // under details - "server": &schema.Schema{ + "server": { Type: schema.TypeString, Required: true, Description: "The server hostname.", }, - "port": &schema.Schema{ + "port": { Type: schema.TypeInt, Required: true, Description: "The port to connect to for this connection.", }, - "database": &schema.Schema{ + "database": { Type: schema.TypeString, Required: true, Description: "The database to connect to for this connection.", }, - "retries": &schema.Schema{ + "retries": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "The number of automatic times to retry a query before failing. Defaults to 1. Queries with syntax errors will not be retried. This setting can be used to overcome intermittent network issues.", }, - "login_timeout": &schema.Schema{ + "login_timeout": { Type: schema.TypeInt, Optional: true, Default: 0, Description: "The number of seconds used to establish a connection before failing. Defaults to 0, which means that the timeout is disabled or uses the default system settings.", }, - "query_timeout": &schema.Schema{ + "query_timeout": { Type: schema.TypeInt, Optional: true, Default: 0, Description: "The number of seconds used to wait for a query before failing. Defaults to 0, which means that the timeout is disabled or uses the default system settings.", }, - "adapter_id": &schema.Schema{ + "adapter_id": { Type: schema.TypeInt, Computed: true, Description: "Adapter id created for the Fabric connection", diff --git a/pkg/sdkv2/resources/fabric_credential.go b/pkg/sdkv2/resources/fabric_credential.go index 854f7fc..f059b29 100644 --- a/pkg/sdkv2/resources/fabric_credential.go +++ b/pkg/sdkv2/resources/fabric_credential.go @@ -19,30 +19,30 @@ func ResourceFabricCredential() *schema.Resource { DeleteContext: resourceFabricCredentialDelete, Schema: map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the Fabric credential in", }, - "adapter_id": &schema.Schema{ + "adapter_id": { Type: schema.TypeInt, Required: true, Description: "Fabric adapter ID for the credential", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Computed: true, Description: "The system Fabric credential ID", }, - "user": &schema.Schema{ + "user": { Type: schema.TypeString, Optional: true, Default: "", Description: "The username of the Fabric account to connect to. Only used when connection with AD user/pass", ConflictsWith: []string{"tenant_id", "client_id", "client_secret"}, }, - "password": &schema.Schema{ + "password": { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -50,21 +50,21 @@ func ResourceFabricCredential() *schema.Resource { Description: "The password for the account to connect to. Only used when connection with AD user/pass", ConflictsWith: []string{"tenant_id", "client_id", "client_secret"}, }, - "tenant_id": &schema.Schema{ + "tenant_id": { Type: schema.TypeString, Optional: true, Default: "", Description: "The tenant ID of the Azure Active Directory instance. This is only used when connecting to Azure SQL with a service principal.", ConflictsWith: []string{"user", "password"}, }, - "client_id": &schema.Schema{ + "client_id": { Type: schema.TypeString, Optional: true, Default: "", Description: "The client ID of the Azure Active Directory service principal. This is only used when connecting to Azure SQL with an AAD service principal.", ConflictsWith: []string{"user", "password"}, }, - "client_secret": &schema.Schema{ + "client_secret": { Type: schema.TypeString, Optional: true, Sensitive: true, @@ -72,13 +72,13 @@ func ResourceFabricCredential() *schema.Resource { Description: "The client secret of the Azure Active Directory service principal. This is only used when connecting to Azure SQL with an AAD service principal.", ConflictsWith: []string{"user", "password"}, }, - "schema": &schema.Schema{ + "schema": { Type: schema.TypeString, Required: true, Description: "The schema where to create the dbt models", ConflictsWith: []string{}, }, - "schema_authorization": &schema.Schema{ + "schema_authorization": { Type: schema.TypeString, Optional: true, Default: "", @@ -322,8 +322,9 @@ func resourceFabricCredentialDelete( fabricCredential.State = dbt_cloud.STATE_DELETED - // // those values don't mean anything for the delete operation but they are required by the API - emptyFabricCredentialDetails, err := dbt_cloud.GenerateFabricCredentialDetails( + // These values don't mean anything for the delete operation but they are required by the API + // TODO(cwalden): do we need to handle this err? + emptyFabricCredentialDetails, _ := dbt_cloud.GenerateFabricCredentialDetails( "", "", "", diff --git a/pkg/sdkv2/resources/job.go b/pkg/sdkv2/resources/job.go index c2c2da8..fc48887 100644 --- a/pkg/sdkv2/resources/job.go +++ b/pkg/sdkv2/resources/job.go @@ -25,29 +25,29 @@ var ( ) var jobSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID to create the job in", ForceNew: true, }, - "environment_id": &schema.Schema{ + "environment_id": { Type: schema.TypeInt, Required: true, Description: "Environment ID to create the job in", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Job name", }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, Default: "", Description: "Description for the job", }, - "execute_steps": &schema.Schema{ + "execute_steps": { Type: schema.TypeList, MinItems: 1, Required: true, @@ -56,18 +56,18 @@ var jobSchema = map[string]*schema.Schema{ }, Description: "List of commands to execute for the job", }, - "dbt_version": &schema.Schema{ + "dbt_version": { Type: schema.TypeString, Optional: true, Description: "Version number of dbt to use in this job, usually in the format 1.2.0-latest rather than core versions", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Should always be set to true as setting it to false is the same as creating a job in a deleted state. To create/keep a job in a 'deactivated' state, check the `triggers` config.", }, - "triggers": &schema.Schema{ + "triggers": { Type: schema.TypeMap, Required: true, Elem: &schema.Schema{ @@ -77,38 +77,38 @@ var jobSchema = map[string]*schema.Schema{ }, Description: "Flags for which types of triggers to use, the values are `github_webhook`, `git_provider_webhook`, `schedule` and `on_merge`. All flags should be listed and set with `true` or `false`. When `on_merge` is `true`, all the other values must be false.
`custom_branch_only` used to be allowed but has been deprecated from the API. The jobs will use the custom branch of the environment. Please remove the `custom_branch_only` from your config.
To create a job in a 'deactivated' state, set all to `false`.", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Optional: true, Default: 1, Description: "Number of threads to use in the job", }, - "target_name": &schema.Schema{ + "target_name": { Type: schema.TypeString, Optional: true, Default: "default", Description: "Target name for the dbt profile", }, - "generate_docs": &schema.Schema{ + "generate_docs": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Flag for whether the job should generate documentation", }, - "run_generate_sources": &schema.Schema{ + "run_generate_sources": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Flag for whether the job should add a `dbt source freshness` step to the job. The difference between manually adding a step with `dbt source freshness` in the job steps or using this flag is that with this flag, a failed freshness will still allow the following steps to run.", }, - "schedule_type": &schema.Schema{ + "schedule_type": { Type: schema.TypeString, Optional: true, Default: "every_day", Description: "Type of schedule to use, one of every_day/ days_of_week/ custom_cron", ValidateFunc: validation.StringInSlice(scheduleTypes, false), }, - "schedule_interval": &schema.Schema{ + "schedule_interval": { Type: schema.TypeInt, Optional: true, Default: 1, @@ -116,7 +116,7 @@ var jobSchema = map[string]*schema.Schema{ ValidateFunc: validation.IntBetween(1, 23), ConflictsWith: []string{"schedule_hours", "schedule_cron"}, }, - "schedule_hours": &schema.Schema{ + "schedule_hours": { Type: schema.TypeList, MinItems: 1, Optional: true, @@ -126,7 +126,7 @@ var jobSchema = map[string]*schema.Schema{ Description: "List of hours to execute the job at if running on a schedule", ConflictsWith: []string{"schedule_interval", "schedule_cron"}, }, - "schedule_days": &schema.Schema{ + "schedule_days": { Type: schema.TypeList, MinItems: 1, Optional: true, @@ -135,43 +135,43 @@ var jobSchema = map[string]*schema.Schema{ }, Description: "List of days of week as numbers (0 = Sunday, 7 = Saturday) to execute the job at if running on a schedule", }, - "schedule_cron": &schema.Schema{ + "schedule_cron": { Type: schema.TypeString, Optional: true, Description: "Custom cron expression for schedule", ConflictsWith: []string{"schedule_interval", "schedule_hours"}, }, - "deferring_job_id": &schema.Schema{ + "deferring_job_id": { Type: schema.TypeInt, Optional: true, Description: "Job identifier that this job defers to (legacy deferring approach)", ConflictsWith: []string{"self_deferring", "deferring_environment_id"}, }, - "deferring_environment_id": &schema.Schema{ + "deferring_environment_id": { Type: schema.TypeInt, Optional: true, Description: "Environment identifier that this job defers to (new deferring approach)", ConflictsWith: []string{"self_deferring", "deferring_job_id"}, }, - "self_deferring": &schema.Schema{ + "self_deferring": { Type: schema.TypeBool, Optional: true, Description: "Whether this job defers on a previous run of itself", ConflictsWith: []string{"deferring_job_id"}, }, - "timeout_seconds": &schema.Schema{ + "timeout_seconds": { Type: schema.TypeInt, Optional: true, Default: 0, Description: "Number of seconds to allow the job to run before timing out", }, - "triggers_on_draft_pr": &schema.Schema{ + "triggers_on_draft_pr": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether the CI job should be automatically triggered on draft PRs", }, - "job_completion_trigger_condition": &schema.Schema{ + "job_completion_trigger_condition": { Type: schema.TypeSet, Optional: true, // using a set or a list with 1 item is the way in the SDKv2 to define nested objects diff --git a/pkg/sdkv2/resources/license_map.go b/pkg/sdkv2/resources/license_map.go index a24bfd1..b017ac0 100644 --- a/pkg/sdkv2/resources/license_map.go +++ b/pkg/sdkv2/resources/license_map.go @@ -27,13 +27,13 @@ func ResourceLicenseMap() *schema.Resource { DeleteContext: licenseMapDelete, Schema: map[string]*schema.Schema{ - "license_type": &schema.Schema{ + "license_type": { Type: schema.TypeString, Required: true, Description: "License type", ValidateFunc: validation.StringInSlice(licenseTypes, false), }, - "sso_license_mapping_groups": &schema.Schema{ + "sso_license_mapping_groups": { Type: schema.TypeSet, Optional: true, Description: "SSO license mapping group names for this group", diff --git a/pkg/sdkv2/resources/postgres_credential.go b/pkg/sdkv2/resources/postgres_credential.go index b113c48..af224c6 100644 --- a/pkg/sdkv2/resources/postgres_credential.go +++ b/pkg/sdkv2/resources/postgres_credential.go @@ -27,52 +27,52 @@ func ResourcePostgresCredential() *schema.Resource { DeleteContext: resourcePostgresCredentialDelete, Schema: map[string]*schema.Schema{ - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the Postgres/Redshift/AlloyDB credential is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the Postgres/Redshift/AlloyDB credential in", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Computed: true, Description: "The system Postgres/Redshift/AlloyDB credential ID", }, - "type": &schema.Schema{ + "type": { Type: schema.TypeString, Required: true, Description: "Type of connection. One of (postgres/redshift). Use postgres for alloydb connections", ValidateFunc: validation.StringInSlice(warehouseTypes, false), }, - "default_schema": &schema.Schema{ + "default_schema": { Type: schema.TypeString, Required: true, Description: "Default schema name", }, - "target_name": &schema.Schema{ + "target_name": { Type: schema.TypeString, Optional: true, Default: "default", Description: "Default schema name", }, - "username": &schema.Schema{ + "username": { Type: schema.TypeString, Required: true, Description: "Username for Postgres/Redshift/AlloyDB", }, - "password": &schema.Schema{ + "password": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "Password for Postgres/Redshift/AlloyDB", }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Optional: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/resources/project.go b/pkg/sdkv2/resources/project.go index 8a0fdc7..b0b8c99 100644 --- a/pkg/sdkv2/resources/project.go +++ b/pkg/sdkv2/resources/project.go @@ -11,12 +11,12 @@ import ( ) var projectSchema = map[string]*schema.Schema{ - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Project name", }, - "dbt_project_subdirectory": &schema.Schema{ + "dbt_project_subdirectory": { Type: schema.TypeString, Optional: true, Description: "dbt project subdirectory path", diff --git a/pkg/sdkv2/resources/project_artefacts.go b/pkg/sdkv2/resources/project_artefacts.go index 89247f0..a26a7bd 100644 --- a/pkg/sdkv2/resources/project_artefacts.go +++ b/pkg/sdkv2/resources/project_artefacts.go @@ -12,18 +12,18 @@ import ( ) var projectArtefactsSchema = map[string]*schema.Schema{ - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", ForceNew: true, }, - "docs_job_id": &schema.Schema{ + "docs_job_id": { Type: schema.TypeInt, Optional: true, Description: "Docs Job ID", }, - "freshness_job_id": &schema.Schema{ + "freshness_job_id": { Type: schema.TypeInt, Optional: true, Description: "Freshness Job ID", diff --git a/pkg/sdkv2/resources/project_connection.go b/pkg/sdkv2/resources/project_connection.go index 4bfde11..9c11df8 100644 --- a/pkg/sdkv2/resources/project_connection.go +++ b/pkg/sdkv2/resources/project_connection.go @@ -12,13 +12,13 @@ import ( ) var projectConnectionSchema = map[string]*schema.Schema{ - "connection_id": &schema.Schema{ + "connection_id": { Type: schema.TypeInt, Required: true, Description: "Connection ID", ForceNew: true, }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", diff --git a/pkg/sdkv2/resources/project_repository.go b/pkg/sdkv2/resources/project_repository.go index bc9a2c1..dad72e1 100644 --- a/pkg/sdkv2/resources/project_repository.go +++ b/pkg/sdkv2/resources/project_repository.go @@ -12,13 +12,13 @@ import ( ) var projectRepositorySchema = map[string]*schema.Schema{ - "repository_id": &schema.Schema{ + "repository_id": { Type: schema.TypeInt, Required: true, Description: "Repository ID", ForceNew: true, }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, Description: "Project ID", diff --git a/pkg/sdkv2/resources/repository.go b/pkg/sdkv2/resources/repository.go index 3c30e46..c65c8df 100644 --- a/pkg/sdkv2/resources/repository.go +++ b/pkg/sdkv2/resources/repository.go @@ -18,82 +18,82 @@ func ResourceRepository() *schema.Resource { DeleteContext: resourceRepositoryDelete, Schema: map[string]*schema.Schema{ - "repository_id": &schema.Schema{ + "repository_id": { Type: schema.TypeInt, Computed: true, Description: "Repository Identifier", }, - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the repository is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the repository in", }, - "remote_url": &schema.Schema{ + "remote_url": { Type: schema.TypeString, Required: true, ForceNew: true, Description: "Git URL for the repository or \\/\\ for Gitlab", }, - "git_clone_strategy": &schema.Schema{ + "git_clone_strategy": { Type: schema.TypeString, Optional: true, Default: "deploy_key", ForceNew: true, Description: "Git clone strategy for the repository. Can be `deploy_key` (default) for cloning via SSH Deploy Key, `github_app` for GitHub native integration, `deploy_token` for the GitLab native integration and `azure_active_directory_app` for ADO native integration", }, - "repository_credentials_id": &schema.Schema{ + "repository_credentials_id": { Type: schema.TypeInt, Computed: true, Description: "Credentials ID for the repository (From the repository side not the dbt Cloud ID)", }, - "gitlab_project_id": &schema.Schema{ + "gitlab_project_id": { Type: schema.TypeInt, Optional: true, ForceNew: true, Description: "Identifier for the Gitlab project - (for GitLab native integration only)", }, - "github_installation_id": &schema.Schema{ + "github_installation_id": { Type: schema.TypeInt, Optional: true, ForceNew: true, Description: "Identifier for the GitHub App - (for GitHub native integration only)", }, - "azure_active_directory_project_id": &schema.Schema{ + "azure_active_directory_project_id": { Type: schema.TypeString, Optional: true, Default: "", ForceNew: true, Description: "The Azure Dev Ops project ID. It can be retrieved via the Azure API or using the data source `dbtcloud_azure_dev_ops_project` and the project name - (for ADO native integration only)", }, - "azure_active_directory_repository_id": &schema.Schema{ + "azure_active_directory_repository_id": { Type: schema.TypeString, Optional: true, Default: "", ForceNew: true, Description: "The Azure Dev Ops repository ID. It can be retrieved via the Azure API or using the data source `dbtcloud_azure_dev_ops_repository` along with the ADO Project ID and the repository name - (for ADO native integration only)", }, - "azure_bypass_webhook_registration_failure": &schema.Schema{ + "azure_bypass_webhook_registration_failure": { Type: schema.TypeBool, Optional: true, Default: false, ForceNew: true, Description: "If set to False (the default), the connection will fail if the service user doesn't have access to set webhooks (required for auto-triggering CI jobs). If set to True, the connection will be successful but no automated CI job will be triggered - (for ADO native integration only)", }, - "fetch_deploy_key": &schema.Schema{ + "fetch_deploy_key": { Type: schema.TypeBool, Optional: true, Default: false, Description: "Whether we should return the public deploy key - (for the `deploy_key` strategy)", Deprecated: "This field is deprecated and will be removed in a future version of the provider, please remove it from your configuration. The key is always fetched when the clone strategy is `deploy_key`", }, - "deploy_key": &schema.Schema{ + "deploy_key": { Type: schema.TypeString, Computed: true, Description: "Public key generated by dbt when using `deploy_key` clone strategy", diff --git a/pkg/sdkv2/resources/snowflake_credential.go b/pkg/sdkv2/resources/snowflake_credential.go index a07bc27..28d8f9b 100644 --- a/pkg/sdkv2/resources/snowflake_credential.go +++ b/pkg/sdkv2/resources/snowflake_credential.go @@ -27,76 +27,76 @@ func ResourceSnowflakeCredential() *schema.Resource { DeleteContext: resourceSnowflakeCredentialDelete, Schema: map[string]*schema.Schema{ - "is_active": &schema.Schema{ + "is_active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Whether the Snowflake credential is active", }, - "project_id": &schema.Schema{ + "project_id": { Type: schema.TypeInt, Required: true, ForceNew: true, Description: "Project ID to create the Snowflake credential in", }, - "credential_id": &schema.Schema{ + "credential_id": { Type: schema.TypeInt, Computed: true, Description: "The system Snowflake credential ID", }, - "auth_type": &schema.Schema{ + "auth_type": { Type: schema.TypeString, Required: true, Description: "The type of Snowflake credential ('password' or 'keypair')", ValidateFunc: validation.StringInSlice(authTypes, false), }, - "database": &schema.Schema{ + "database": { Type: schema.TypeString, Optional: true, Description: "Database to connect to", }, - "role": &schema.Schema{ + "role": { Type: schema.TypeString, Optional: true, Description: "Role to assume", }, - "warehouse": &schema.Schema{ + "warehouse": { Type: schema.TypeString, Optional: true, Description: "Warehouse to use", }, - "schema": &schema.Schema{ + "schema": { Type: schema.TypeString, Required: true, Description: "Default schema name", }, - "user": &schema.Schema{ + "user": { Type: schema.TypeString, Required: true, Description: "Username for Snowflake", }, - "password": &schema.Schema{ + "password": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "Password for Snowflake", ConflictsWith: []string{"private_key", "private_key_passphrase"}, }, - "private_key": &schema.Schema{ + "private_key": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "Private key for Snowflake", ConflictsWith: []string{"password"}, }, - "private_key_passphrase": &schema.Schema{ + "private_key_passphrase": { Type: schema.TypeString, Optional: true, Sensitive: true, Description: "Private key passphrase for Snowflake", ConflictsWith: []string{"password"}, }, - "num_threads": &schema.Schema{ + "num_threads": { Type: schema.TypeInt, Required: true, Description: "Number of threads to use", diff --git a/pkg/sdkv2/resources/user_groups.go b/pkg/sdkv2/resources/user_groups.go index 30e698b..9402e75 100644 --- a/pkg/sdkv2/resources/user_groups.go +++ b/pkg/sdkv2/resources/user_groups.go @@ -20,12 +20,12 @@ func ResourceUserGroups() *schema.Resource { DeleteContext: resourceUserGroupsDelete, Schema: map[string]*schema.Schema{ - "user_id": &schema.Schema{ + "user_id": { Type: schema.TypeInt, Required: true, Description: "The internal ID of a dbt Cloud user", }, - "group_ids": &schema.Schema{ + "group_ids": { Type: schema.TypeSet, Required: true, Description: "IDs of the groups to assign to the user. If additional groups were assigned manually in dbt Cloud, they will be removed.", @@ -59,7 +59,7 @@ func checkGroupsAssigned(groupIDs []int, groupsAssigned *dbt_cloud.AssignUserGro for _, groupID := range groupIDs { if !groupIDsAssignedMap[groupID] { - return fmt.Errorf("The Group %d was not assigned to the user. It is possible that it doesn't exist and needs to be removed from the config.", groupID) + return fmt.Errorf("the Group %d was not assigned to the user (it's possible that it doesn't exist and needs to be removed from the config)", groupID) } } @@ -102,6 +102,9 @@ func resourceUserGroupsRead(ctx context.Context, d *schema.ResourceData, m inter var diags diag.Diagnostics userID, err := strconv.Atoi(d.Id()) + if err != nil { + return diag.FromErr(err) + } userGroups, err := c.GetUserGroups(userID) if err != nil { diff --git a/pkg/sdkv2/resources/webhook.go b/pkg/sdkv2/resources/webhook.go index 5166c86..745da0e 100644 --- a/pkg/sdkv2/resources/webhook.go +++ b/pkg/sdkv2/resources/webhook.go @@ -20,28 +20,28 @@ var ( ) var webhookSchema = map[string]*schema.Schema{ - "webhook_id": &schema.Schema{ + "webhook_id": { Type: schema.TypeString, Computed: true, Description: "Webhooks ID", }, - "name": &schema.Schema{ + "name": { Type: schema.TypeString, Required: true, Description: "Webhooks Name", }, - "description": &schema.Schema{ + "description": { Type: schema.TypeString, Optional: true, Default: "", Description: "Webhooks Description", }, - "client_url": &schema.Schema{ + "client_url": { Type: schema.TypeString, Required: true, Description: "Webhooks Client URL", }, - "event_types": &schema.Schema{ + "event_types": { Type: schema.TypeList, Required: true, Description: "Webhooks Event Types", @@ -50,7 +50,7 @@ var webhookSchema = map[string]*schema.Schema{ ValidateFunc: validation.StringInSlice(eventTypes, false), }, }, - "job_ids": &schema.Schema{ + "job_ids": { Type: schema.TypeList, Optional: true, Description: "List of job IDs to trigger the webhook, An empty list will trigger on all jobs", @@ -58,24 +58,24 @@ var webhookSchema = map[string]*schema.Schema{ Type: schema.TypeInt, }, }, - "active": &schema.Schema{ + "active": { Type: schema.TypeBool, Optional: true, Default: true, Description: "Webhooks active flag", }, - "hmac_secret": &schema.Schema{ + "hmac_secret": { Type: schema.TypeString, Computed: true, Sensitive: true, Description: "Secret key for the webhook. Can be used to validate the authenticity of the webhook.", }, - "http_status_code": &schema.Schema{ + "http_status_code": { Type: schema.TypeString, Computed: true, Description: "Latest HTTP status of the webhook", }, - "account_identifier": &schema.Schema{ + "account_identifier": { Type: schema.TypeString, Computed: true, Description: "Webhooks Account Identifier",