Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project structure of terraform provider and cockroach cluster functionality #1

Merged
merged 1 commit into from
Apr 25, 2022

Conversation

prafull01
Copy link
Collaborator

  • Added the basic project structure.
  • Added functionality to create/update/delete the cockroach cluster using TF provider


type clusterDataSourceType struct{}

func (t clusterDataSourceType) GetSchema(ctx context.Context) (tfsdk.Schema, diag.Diagnostics) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prafull01 What is the difference between the cluster "resource" and the cluster "data source"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resource is termed as the resource which we are trying to create. For example we are creating the cockroach-cluster we will define it as:

resource "cockroach_cluster" "cockroach" {
    name           = "cockroach-cluster"
    cloud_provider = "CLOUD_PROVIDER_GCP"
    spec = {
    serverless = {
        regions = ["us-east1"]
        spend_limit = 0
        }
    }
}

data source is used to the load the existing resource into the terraform state. Lets say we want to load the existing cluster in the terraform state to create the SQL User in the cluster, we will add the following in terraform file:

data "cockroach_cluster" "existing" {
    id = "clusterid"
} 

This will read the cluster and load into the existing object so that we can use further information we fetched in creating the SQL User

go test -i $(TEST) || exit 1
echo $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=30s -parallel=4

testacc:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prafull01 what are you thinking about in terms of overall testing strategy?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing strategy is yet to be determined, I have added this only as scaffolding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants