Skip to content

Commit

Permalink
Update examples and optional fields on the provider
Browse files Browse the repository at this point in the history
  • Loading branch information
Talina06 committed Dec 9, 2023
1 parent 3504fc0 commit b2443bb
Show file tree
Hide file tree
Showing 44 changed files with 9 additions and 94 deletions.
1 change: 0 additions & 1 deletion examples/allowlist/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/allowlist/terraform.template.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
project_id = "<project_id>"
cluster_id = "<cluster_id>"
host = "https://cloudapi.cloud.couchbase.com"

allowlist = {
cidr = "10.0.0.0/16"
Expand Down
4 changes: 0 additions & 4 deletions examples/allowlist/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/apikey/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}

1 change: 0 additions & 1 deletion examples/apikey/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"

apikey = {
name = "New Terraform Api Key"
Expand Down
7 changes: 1 addition & 6 deletions examples/apikey/variables.tf
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
variable "host" {
default = "https://cloudapi.dev.nonprod-project-avengers.com"
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down Expand Up @@ -33,4 +28,4 @@ variable "resources" {
type = optional(string)
}))
default = []
}
}
3 changes: 1 addition & 2 deletions examples/appservice/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
}
1 change: 0 additions & 1 deletion examples/appservice/terraform.template.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ auth_token = "v4-api-key-secret"
organization_id = "<organization_id>"
project_id = "<project_id>"
cluster_id = "<cluster_id>"
host = "https://cloudapi.cloud.couchbase.com"

app_service = {
name = "new-terraform-app-service"
Expand Down
6 changes: 1 addition & 5 deletions examples/appservice/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down Expand Up @@ -31,4 +27,4 @@ variable "app_service" {
ram = number
})
})
}
}
1 change: 0 additions & 1 deletion examples/backup/create_backups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/backup/create_backups/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
host = "https://cloudapi.cloud.couchbase.com"

organization_id = "<organization_id>"
project_id = "<project_id>"
Expand Down
4 changes: 0 additions & 4 deletions examples/backup/create_backups/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/backup/list_backups/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/backup/list_backups/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
host = "https://cloudapi.cloud.couchbase.com"

organization_id = "<organization_id>"
project_id = "<project_id>"
Expand Down
4 changes: 0 additions & 4 deletions examples/backup/list_backups/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/backup_schedule/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/backup_schedule/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
host = "https://cloudapi.cloud.couchbase.com"

organization_id = "<organization_id>"
project_id = "<project_id>"
Expand Down
4 changes: 0 additions & 4 deletions examples/backup_schedule/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}

1 change: 0 additions & 1 deletion examples/bucket/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
host = "https://cloudapi.cloud.couchbase.com"

organization_id = "<organization_id>"
project_id = "<project_id>"
Expand Down
4 changes: 0 additions & 4 deletions examples/bucket/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/certificate/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/certificate/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"
project_id = "<project_id>"
cluster_id = "<cluster_id>"
4 changes: 0 additions & 4 deletions examples/certificate/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 0 additions & 1 deletion examples/cluster/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}

1 change: 0 additions & 1 deletion examples/cluster/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"
project_id = "<project_id>"

cloud_provider = {
Expand Down
4 changes: 0 additions & 4 deletions examples/cluster/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "auth_token" {
description = "Authentication API Key"
sensitive = true
Expand Down
1 change: 0 additions & 1 deletion examples/database_credential/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}

1 change: 0 additions & 1 deletion examples/database_credential/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
project_id = "<project_id>"
host = "https://cloudapi.cloud.couchbase.com"
cluster_id = "<cluster_id>"

database_credential = {
Expand Down
4 changes: 0 additions & 4 deletions examples/database_credential/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
1 change: 1 addition & 0 deletions examples/getting_started/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ resource "couchbase-capella_cluster" "new_cluster" {
availability = {
"type" : var.cluster.availability_zone
}
configuration_type = var.cluster.configuration_type
support = {
plan = var.support.plan
timezone = var.support.timezone
Expand Down
1 change: 0 additions & 1 deletion examples/getting_started/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/getting_started/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
auth_token = "<v4-api-key-secret>"
host = "https://cloudapi.cloud.couchbase.com"

organization_id = "<organization_id>"
project_name = "My First Terraform Project"
Expand Down
4 changes: 0 additions & 4 deletions examples/getting_started/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "auth_token" {
description = "Authentication API Key"
sensitive = true
Expand Down
1 change: 0 additions & 1 deletion examples/organization/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
1 change: 0 additions & 1 deletion examples/organization/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"
4 changes: 0 additions & 4 deletions examples/organization/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "auth_token" {
description = "Authentication API Key"
sensitive = true
Expand Down
1 change: 0 additions & 1 deletion examples/project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
3 changes: 1 addition & 2 deletions examples/project/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"
organization_id = "<organization_id>"
6 changes: 1 addition & 5 deletions examples/project/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand All @@ -14,4 +10,4 @@ variable "auth_token" {
variable "project_name" {
default = "terraform-couchbasecapella-project"
description = "Project Name for Project Created via Terraform"
}
}
1 change: 0 additions & 1 deletion examples/user/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ terraform {
}

provider "couchbase-capella" {
host = var.host
authentication_token = var.auth_token
}
2 changes: 0 additions & 2 deletions examples/user/terraform.template.tfvars
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
auth_token = "<v4-api-key-secret>"
organization_id = "<organization_id>"
host = "https://cloudapi.cloud.couchbase.com"


user = {
name = "John ABC"
Expand Down
4 changes: 0 additions & 4 deletions examples/user/variables.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
variable "host" {
description = "The Host URL of Couchbase Cloud."
}

variable "organization_id" {
description = "Capella Organization ID"
}
Expand Down
6 changes: 3 additions & 3 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const (
capellaAuthenticationTokenField = "authentication_token"
capellaPublicAPIHostField = "host"
apiRequestTimeout = 60 * time.Second
defaultAPIHostURL = "https://cloudapi.couchbase.com"
defaultAPIHostURL = "https://cloudapi.cloud.couchbase.com"
providerName = "couchbase-capella"
)

Expand Down Expand Up @@ -55,7 +55,7 @@ func (p *capellaProvider) Schema(_ context.Context, _ provider.SchemaRequest, re
resp.Schema = schema.Schema{
Attributes: map[string]schema.Attribute{
capellaPublicAPIHostField: schema.StringAttribute{
Required: true,
Optional: true,
Description: "Capella Public API HTTPS Host URL",
},
capellaAuthenticationTokenField: schema.StringAttribute{
Expand Down Expand Up @@ -83,7 +83,7 @@ func (p *capellaProvider) Configure(ctx context.Context, req provider.ConfigureR
// attributes, it must be a known value.

// if the host URL is not provided, connect to the production Capella API host url by default.
if config.Host.IsUnknown() {
if config.Host.IsNull() {
config.Host = types.StringValue(defaultAPIHostURL)
}

Expand Down

0 comments on commit b2443bb

Please sign in to comment.