|
| 1 | +# Starter kit for a Terraform module |
| 2 | + |
| 3 | +This is a Starter kit to help with the creation of Terraform modules. The basic structure of a Terraform module is fairly |
| 4 | +simple and consists of the following basic values: |
| 5 | + |
| 6 | +- README.md - provides a description of the module |
| 7 | +- main.tf - defiens the logic for the module |
| 8 | +- variables.tf (optional) - defines the input variables for the module |
| 9 | +- outputs.tf (optional) - defines the values that are output from the module |
| 10 | + |
| 11 | +Beyond those files, any other content can be added and organized however you see fit. For example, you can add a `scripts/` directory |
| 12 | +that contains shell scripts executed by a `local-exec` `null_resource` in the terraform module. The contents will depend on what your |
| 13 | +module does and how it does it. |
| 14 | + |
| 15 | +## Instructions for creating a new module |
| 16 | + |
| 17 | +1. Update the title and description in the README to match the module you are creating |
| 18 | +2. Fill out the remaining sections in the README template as appropriate |
| 19 | +3. Implement your logic in the in the main.tf, variables.tf, and outputs.tf |
| 20 | +4. Use releases/tags to manage release versions of your module |
| 21 | + |
| 22 | +## Software dependencies |
| 23 | + |
| 24 | +The module depends on the following software components: |
| 25 | + |
| 26 | +### Command-line tools |
| 27 | + |
| 28 | +- terraform - v12 |
| 29 | +- kubectl |
| 30 | + |
| 31 | +### Terraform providers |
| 32 | + |
| 33 | +- IBM Cloud provider >= 1.5.3 |
| 34 | +- Helm provider >= 1.1.1 (provided by Terraform) |
| 35 | + |
| 36 | +## Module dependencies |
| 37 | + |
| 38 | +This module makes use of the output from other modules: |
| 39 | + |
| 40 | +- Cluster - github.com/ibm-garage-cloud/terraform-ibm-container-platform.git |
| 41 | +- Namespace - github.com/ibm-garage-clout/terraform-cluster-namespace.git |
| 42 | +- etc |
| 43 | + |
| 44 | +## Example usage |
| 45 | + |
| 46 | +```hcl-terraform |
| 47 | +module "dev_tools_argocd" { |
| 48 | + source = "github.com/ibm-garage-cloud/terraform-tools-argocd.git?ref=v1.0.0" |
| 49 | +
|
| 50 | + cluster_config_file = module.dev_cluster.config_file_path |
| 51 | + cluster_type = module.dev_cluster.type |
| 52 | + app_namespace = module.dev_cluster_namespaces.tools_namespace_name |
| 53 | + ingress_subdomain = module.dev_cluster.ingress_hostname |
| 54 | + olm_namespace = module.dev_software_olm.olm_namespace |
| 55 | + operator_namespace = module.dev_software_olm.target_namespace |
| 56 | + name = "argocd" |
| 57 | +} |
| 58 | +``` |
| 59 | + |
0 commit comments