All the module calls made from this folder from dev.tf file.
- This folder contains following files
- dev.tf (modules file )
- backend.tf ( contains backend configuration of the terraform, which contains terraform state files).
- outputs.tf ( output's of the resource attributes after terraform apply)
- version.tf ( contains terraform version and cloud provider version)
- variables.tf (all the variable which required by the terraform modules.)
A Terraform Module is a canonical, reusable, best-practices definition for how to run a single piece of infrastructure, such as a database or server cluster. Each Module is written using a combination of Terraform and scripts (mostly bash) and include automated tests, documentation, and examples.
- Every module has:
- Input variables: to accept values from the calling module.
- Output values: to return results to the calling module, which it can then use to populate arguments elsewhere.
- Resources: to define one or more infrastructure objects that the module will manage.
- Source: A source can be any local folder path or remote module located in source control systems like git.
Usage: The following module call will create GKE cluster and cluster node pool resources. Resources will be configured by using the following input variables on this module.
# Module used for creating a google kubernetes cluster.
module "gke" {
source = "../modules/gke"
environment = var.environment
name = local.prefix
region = var.region
project_id = var.project_id
initial_node_count = var.initial_node_count
machine_type = var.machine_type
network_link = module.vpc.network_selflink
subnetwork_link = module.vpc.subnetwork_selflink
service_account = module.iam.service_account
}
Usage: The following module call will create IAM resources. Resources will be configured using the following input variables on this modules.
# Module used for create service account and roles
module "iam" {
source = "../modules/iam"
name = local.prefix
region = var.region
project_id = var.project_id
service_account_custom_iam_roles = var.service_account_custom_iam_roles
service_account_iam_roles = var.service_account_iam_roles
}
Usage: The following module call will create google compute network(VPC) and Google Compute Subnet resources. Resources will be configured using the following input variables on this module.
# Module used for creating a google compute network.
module "vpc" {
source = "../modules/vpc"
name = local.prefix
environment = var.environment
region = var.region
project_id = var.project_id
project_services = var.project_services
}
Usage: The following module call will create google cloud storage bucket. Resources will be configured using following input variables on this module.
# Module used for create google cloud storage bucket
module "gcs" {
source = "../modules/gcs"
name = format("%s-storage-bucket", local.prefix)
region = var.region
environment = var.environment
project_id = var.project_id
service_account = module.iam.service_account
}
Name | Version |
---|---|
terraform | >= 0.12 |
~> 3.0 |
No providers.
Name | Source | Version |
---|---|---|
gcs | ../modules/gcs | |
gke | ../modules/gke | |
iam | ../modules/iam | |
vpc | ../modules/vpc |
No resources.
Name | Description | Type | Default | Required |
---|---|---|---|---|
environment | Name of the environment where infrastructure being built. | any |
n/a | yes |
initial_node_count | n/a | number |
1 |
no |
k8s_namespace | The namespace to use for the deployment and workload identity binding | string |
"default" |
no |
machine_type | Type of machines which are used by cluster node pool | string |
"e2-highmem-8" |
no |
name | Name is the prefix to use for resources that needs to be created. | string |
"k8ssandra" |
no |
project_id | The GCP project in which the components are created. | string |
"k8ssandra-testing" |
no |
project_services | The GCP APIs that should be enabled in this project. | list(string) |
[ |
no |
region | The region in which to create the VPC network | string |
"us-central1" |
no |
service_account_custom_iam_roles | List of arbitrary additional IAM roles to attach to the service account on the GKE nodes. |
list(string) |
[] |
no |
service_account_iam_roles | List of the default IAM roles to attach to the service account on the GKE Nodes. | list(string) |
[ |
no |
zone | The zone in which to create the Kubernetes cluster. Must match the region | string |
"us-central-1a" |
no |
Name | Description |
---|---|
bucket_name | The name of the GCS bucket. |
connect_cluster | Configuring GKE cluster access for kubectl |
endpoint | Endpoint for the GKE cluster |
master_version | Master version of GKE cluster |
service_account | The E-mail id of the service account. |
service_account_key | The service Account Key to configure Medusa backups to use GCS bucket |