Skip to content

Commit

Permalink
[CLOUDGA-18070] Added asymmetric geo example, fmt command in Makefile…
Browse files Browse the repository at this point in the history
…, formatted existing files
  • Loading branch information
beditarun committed Feb 14, 2024
1 parent 57c8bee commit d5f5ed6
Show file tree
Hide file tree
Showing 38 changed files with 253 additions and 178 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ jobs:
exit 1
fi
name: Check documentation
- run: |
make fmt-check
git status -s
if [[ -n $(git status -s) ]]; then
echo "The formatting is not proper. Please ensure that your run 'make fmt'"
exit 1
fi
name: Check documentation
unit:
name: Unit Tests
runs-on: ubuntu-latest
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,12 @@ update-client:

clean:
rm -rf terraform-provider-ybm

fmt:
go fmt ./...
terraform fmt --recursive

fmt-check:
@echo "Verifying formatting, failures can be fixed with 'make fmt'"
@!(gofmt -l -s -d . | grep '[a-z]')
terraform fmt -check --recursive
2 changes: 1 addition & 1 deletion docs/data-sources/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The data source to fetch the backup ID and other information about the most rece

```terraform
data "ybm_backup" "example_backup" {
cluster_id = "example-cluster-id"
cluster_id = "example-cluster-id"
most_recent = true
}
```
Expand Down
2 changes: 1 addition & 1 deletion docs/data-sources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The data source to fetch the cluster ID and other information about a cluster gi
## Example Usage

```terraform
data "ybm_cluster" "example_cluster"{
data "ybm_cluster" "example_cluster" {
cluster_name = "example-cluster"
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ variable "auth_token" {
}
provider "ybm" {
host = "cloud.yugabyte.com"
host = "cloud.yugabyte.com"
use_secure_host = false # True by default
auth_token = var.auth_token
auth_token = var.auth_token
}
```

Expand Down
4 changes: 2 additions & 2 deletions docs/resources/allow_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ The resource to create an allow list in YugabyteDB Managed.

```terraform
resource "ybm_allow_list" "example_allow_list" {
allow_list_name = "allow-all"
allow_list_name = "allow-all"
allow_list_description = "allow all the ip addresses"
cidr_list = ["0.0.0.0/0"]
cidr_list = ["0.0.0.0/0"]
}
```

Expand Down
20 changes: 10 additions & 10 deletions docs/resources/api_key.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@ To issue an API Key with predefined built-in roles like Admin, Developer, Viewer

```terraform
resource "ybm_api_key" "example_api_key" {
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 10
unit = "Hours"
role_name = "Developer"
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 10
unit = "Hours"
role_name = "Developer"
}
```

To issue an API Key with custom user defined roles

```terraform
resource "ybm_api_key" "example_custom_role_api_key" {
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 1
unit = "Months"
role_name = "example-custom-role-name"
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 1
unit = "Months"
role_name = "example-custom-role-name"
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/associate_metrics_exporter_cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ The resource to associate a metrics exporter config to a cluster in YugabyteDB M

```terraform
resource "ybm_associate_metrics_exporter_cluster" "metrics-srcluster" {
cluster_id= ybm_cluster.single_region_cluster.cluster_id
config_id = ybm_metrics_exporter.test.config_id
depends_on = [ ybm_cluster.single_region_cluster, ybm_metrics_exporter.test ]
cluster_id = ybm_cluster.single_region_cluster.cluster_id
config_id = ybm_metrics_exporter.test.config_id
depends_on = [ybm_cluster.single_region_cluster, ybm_metrics_exporter.test]
}
```

Expand Down
6 changes: 3 additions & 3 deletions docs/resources/backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ The resource to create a manual backup of tables in a particular cluster.

```terraform
resource "ybm_backup" "example_backup" {
cluster_id = "example-cluster-id"
backup_description = "example-backup-description"
retention_period_in_days = 2
cluster_id = "example-cluster-id"
backup_description = "example-backup-description"
retention_period_in_days = 2
}
```

Expand Down
46 changes: 23 additions & 23 deletions docs/resources/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ resource "ybm_cluster" "multi_region_cluster" {
vpc_id = "example-vpc-id" #Optional
#vpc_name = "example-vpc-name" #Optional You can also use the VPC Name in place of vpc_id
}
]
cluster_tier = "PAID"
cluster_allow_list_ids = ["example-allow-list-id-1", "example-allow-list-id-2"] #Optional
Expand Down Expand Up @@ -390,9 +390,9 @@ resource "ybm_cluster" "single_region" {
num_nodes = 6
}
]
cluster_tier = "PAID"
cluster_tier = "PAID"
# fault tolerance cannot be NONE for CMK enabled cluster
fault_tolerance = "ZONE"
fault_tolerance = "ZONE"
cmk_spec = {
provider_type = "AWS"
Expand All @@ -403,7 +403,7 @@ resource "ybm_cluster" "single_region" {
"arn:aws:kms:us-west-2:111122223333:key/1234abcd-12ab-34cd-56ef-1234567890ab"
]
}
is_enabled = true
is_enabled = true
}
node_config = {
Expand Down Expand Up @@ -449,31 +449,31 @@ resource "ybm_cluster" "single_region" {
num_nodes = 6
}
]
cluster_tier = "PAID"
cluster_tier = "PAID"
# fault tolerance cannot be NONE for CMK enabled cluster
fault_tolerance = "ZONE"
fault_tolerance = "ZONE"
cmk_spec = {
provider_type = "GCP"
gcp_cmk_spec = {
location = "global"
key_ring_name = "example_cmk_key_ring"
key_name = "example_cmk_key"
protection_level = "software"
gcp_service_account = {
type = "service_account"
project_id = "your-project-id"
private_key_id = "your-private-key-id"
private_key = "-----BEGIN PRIVATE KEY-----\nYourPrivateRSAKey\n-----END PRIVATE KEY-----\n"
client_email = "your-service-account-email@your-project-id.iam.gserviceaccount.com"
client_id = "your-client-id"
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://accounts.google.com/o/oauth2/token"
location = "global"
key_ring_name = "example_cmk_key_ring"
key_name = "example_cmk_key"
protection_level = "software"
gcp_service_account = {
type = "service_account"
project_id = "your-project-id"
private_key_id = "your-private-key-id"
private_key = "-----BEGIN PRIVATE KEY-----\nYourPrivateRSAKey\n-----END PRIVATE KEY-----\n"
client_email = "your-service-account-email@your-project-id.iam.gserviceaccount.com"
client_id = "your-client-id"
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://accounts.google.com/o/oauth2/token"
auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
client_x509_cert_url = "https://www.googleapis.com/.../your-service-account-email%40your-project-id.iam.gserviceaccount.com"
universe_domain = "googleapis.com"
}}
is_enabled = true
client_x509_cert_url = "https://www.googleapis.com/.../your-service-account-email%40your-project-id.iam.gserviceaccount.com"
universe_domain = "googleapis.com"
} }
is_enabled = true
}
node_config = {
num_cores = 4
Expand Down
12 changes: 6 additions & 6 deletions docs/resources/read_replicas.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ The resource to create read replicas of a particular cluster. You can create mul

```terraform
resource "ybm_read_replicas" "example_read_replica" {
read_replicas_info = [
read_replicas_info = [
{
cloud_type = "GCP"
cloud_type = "GCP"
num_replicas = 1
num_nodes = 1
region = "us-east4"
vpc_id = "example-vpc-id"
num_nodes = 1
region = "us-east4"
vpc_id = "example-vpc-id"
node_config = {
num_cores = 2
num_cores = 2
disk_size_gb = 10
}
}
Expand Down
24 changes: 12 additions & 12 deletions docs/resources/role.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ The resource to create a custom role in YugabyteDB Managed.

```terraform
resource "ybm_role" "example_role" {
role_name = "example_role_name"
role_description = "example_role_description" #Optional
permission_list = [
{
resource_type = "CLUSTER"
operation_groups = ["READ"]
},
{
resource_type = "READ_REPLICA"
operation_groups = ["READ", "CREATE"]
}
]
role_name = "example_role_name"
role_description = "example_role_description" #Optional
permission_list = [
{
resource_type = "CLUSTER"
operation_groups = ["READ"]
},
{
resource_type = "READ_REPLICA"
operation_groups = ["READ", "CREATE"]
}
]
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/resources/user.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ To invite a user with predefined built-in roles like Admin, Developer, Viewer

```terraform
resource "ybm_user" "example_user" {
email = "example@example.com"
role_name = "Developer"
email = "example@example.com"
role_name = "Developer"
}
```

To invite a user with custom user defined roles

```terraform
resource "ybm_user" "example_custom_role_user" {
email = "example@example.com"
role_name = "example-custom-role-name"
email = "example@example.com"
role_name = "example-custom-role-name"
}
```

Expand Down
8 changes: 4 additions & 4 deletions docs/resources/vpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The resource to create a VPC in YugabyteDB Managed.

```terraform
resource "ybm_vpc" "example-vpc" {
name = "example-vpc"
name = "example-vpc"
cloud = "GCP"
# Use only one of either global cidr or region cidr
global_cidr = "10.9.0.0/18"
Expand All @@ -34,12 +34,12 @@ resource "ybm_vpc" "example-vpc" {

```terraform
resource "ybm_vpc" "example-vpc" {
name = "example-vpc"
name = "example-vpc"
cloud = "AWS"
region_cidr_info = [
{
region = "us-east-1"
cidr = "10.231.0.0/24"
cidr = "10.231.0.0/24"
}
]
}
Expand All @@ -49,7 +49,7 @@ resource "ybm_vpc" "example-vpc" {

```terraform
resource "ybm_vpc" "example-vpc" {
name = "example-vpc"
name = "example-vpc"
cloud = "AZURE"
region_cidr_info = [
{
Expand Down
16 changes: 8 additions & 8 deletions docs/resources/vpc_peering.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,25 @@ The resource to create a VPC peering in YugabyteDB Managed.
#AWS VPC Peering
resource "ybm_vpc_peering" "example_vpc_peering" {
name = "example_name"
name = "example_name"
yugabytedb_vpc_id = "example_vpc_id"
application_vpc_info = {
cloud = "AWS"
cloud = "AWS"
account_id = "example_account_id"
region = "us-west1"
vpc_id = "application_vpc_id"
cidr = "example_cidr"
region = "us-west1"
vpc_id = "application_vpc_id"
cidr = "example_cidr"
}
}
#GCP VPC Peering
resource "ybm_vpc_peering" "example_vpc_peering" {
name = "example_name"
name = "example_name"
yugabytedb_vpc_id = "example_vpc_id"
application_vpc_info = {
cloud = "GCP"
cloud = "GCP"
project = "example_project"
vpc_id = "application_vpc_id"
vpc_id = "application_vpc_id"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion examples/data-sources/ybm_backup/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

data "ybm_backup" "example_backup" {
cluster_id = "example-cluster-id"
cluster_id = "example-cluster-id"
most_recent = true
}
4 changes: 2 additions & 2 deletions examples/data-sources/ybm_cluster/data-source.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
data "ybm_cluster" "example_cluster"{
data "ybm_cluster" "example_cluster" {
cluster_name = "example-cluster"
}
}
4 changes: 2 additions & 2 deletions examples/provider/provider.tf
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variable "auth_token" {
}

provider "ybm" {
host = "cloud.yugabyte.com"
host = "cloud.yugabyte.com"
use_secure_host = false # True by default
auth_token = var.auth_token
auth_token = var.auth_token
}
4 changes: 2 additions & 2 deletions examples/resources/ybm_allow_list/resource.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "ybm_allow_list" "example_allow_list" {
allow_list_name = "allow-all"
allow_list_name = "allow-all"
allow_list_description = "allow all the ip addresses"
cidr_list = ["0.0.0.0/0"]
cidr_list = ["0.0.0.0/0"]
}
10 changes: 5 additions & 5 deletions examples/resources/ybm_api_key/built-in-role-api-key.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "ybm_api_key" "example_api_key" {
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 10
unit = "Hours"
role_name = "Developer"
name = "example-api-key-name"
description = "example API Key description" #Optional
duration = 10
unit = "Hours"
role_name = "Developer"
}
Loading

0 comments on commit d5f5ed6

Please sign in to comment.