← azuredeploy

Update README and andd nsconf and namespaces

351b38ff0362fe73f2c99ba17c13f29e1a07ee95 · ovidiucs · Feb 10, 2025 23:59

+63 −35 · 3 files changed

  • terraform/deployment/aks/README.md +55 −35
  • terraform/deployment/aks/modules/kubectl/harness-delegate-nsconf.yaml +4 −0
  • terraform/deployment/aks/modules/kubectl/namespaces.yaml +4 −0
diff --git a/terraform/deployment/aks/README.md b/terraform/deployment/aks/README.md
index e7f8d27..371a74f 100644
--- a/terraform/deployment/aks/README.md
+++ b/terraform/deployment/aks/README.md
@@ -1,46 +1,66 @@
-### Overall Directory layout for the terraform deployments
-```.
-├── main.tf                 # Entry point of the Terraform configuration, often contains provider configuration
-├── variables.tf            # Defines variables used across the project
-├── outputs.tf              # Defines outputs from your Terraform configuration
-├── terraform.tfvars        # Contains values for the defined variables
-├── backend.tf              # (Optional) Contains backend configuration for state management
-├── versions.tf             # Sets the Terraform version and provider requirements
-├── README.md               # Project documentation for maintainers and users
-└── modules/
-    ├── network/            # Network module, e.g., VNets, subnets, NSGs
-    │   ├── main.tf
-    │   ├── variables.tf
-    │   ├── outputs.tf
-    │   └── ...
-    ├── compute/            # Compute module, e.g., VMs, scale sets
-    │   ├── main.tf
-    │   ├── variables.tf
-    │   ├── outputs.tf
-    │   └── ...
-    └── storage/            # Storage module, e.g., blob storage, disk
-        ├── main.tf
-        ├── variables.tf
-        ├── outputs.tf
-        └── ...
+# Terraform/Terragrunt Infrastructure Deployment
+
+## Overall Directory Layout
+
+- **kubectl/**
+  - `terragrunt.hcl` – Terragrunt configuration for Kubernetes-related deployments
+- **main.tf** – Entry point of the Terraform configuration, often contains provider configuration
+- **modules/** – Directory containing Terraform modules
+  - **kubectl/** – Module for Kubernetes configurations
+    - `harness-delegate-nsconf.yaml` – Namespace configuration for Harness Delegate
+    - `harness-delegate.yml` – YAML file for deploying Harness Delegate
+    - **kubectl-cfg/** – Kubernetes RBAC configuration
+      - `clusterrolebinding.yaml` – ClusterRoleBinding definition
+      - `secret.yaml` – Secret definition for authentication
+      - `serviceaccount.yaml` – ServiceAccount definition
+    - `main.tf` – Main Terraform file for Kubernetes configuration
+    - `namespaces.yaml` – YAML file defining Kubernetes namespaces
+    - `variables.tf` – Variables for the Kubernetes module
+  - **terraforn-azurerm-aks/** – Module for Azure Kubernetes Service (AKS) deployment
+    - `main.tf` – Main Terraform file for AKS setup
+  - **vm/** – Module for Virtual Machines (VMs)
+    - `vm.tf` – Terraform file for VM provisioning
+- **outputs.tf** – Defines outputs from your Terraform configuration
+- **README.md** – Project documentation for maintainers and users
+- **terraform.tfstate** – Terraform state file (not to be committed to version control)
+- **terraform.tfstate.backup** – Backup of the Terraform state file
+- **terraform.tfvars** – Contains values for the defined variables
+- **terragrunt.hcl** – Configuration file for Terragrunt
+- **variables.tf** – Defines variables used across the project
+- **versions.tf** – Specifies Terraform version and provider requirements
+
 ```
-File and Directory Roles
+## File and Directory Roles
 
-**main.tf**: This is often the entry point for Terraform configurations. In the root directory, it might contain provider configurations and module invocations. Within modules, it contains the main set of resources that module manages.
+### Root-Level Files
 
-**variables.tf:** Defines variables for the module or root configurations, making your configurations flexible and reusable.
+- **main.tf**: The primary Terraform configuration file, which typically defines provider configurations and invokes modules.
+- **variables.tf**: Defines input variables to be used across Terraform configurations.
+- **outputs.tf**: Defines output values, which allow you to retrieve information about provisioned resources.
+- **terraform.tfvars**: Specifies actual values for declared variables. Sensitive values should not be committed to version control.
+- **terraform.tfstate / terraform.tfstate.backup**: Terraform state files used to track infrastructure changes. These should be managed remotely (e.g., in an S3 bucket or Azure Storage).
+- **terragrunt.hcl**: Configuration file for Terragrunt, which simplifies Terraform module management.
+- **versions.tf**: Defines Terraform and provider version constraints to ensure compatibility.
+- **README.md**: Documentation for setting up and managing the project.
 
-**outputs.tf:** Defines output values that you can use to retrieve information about the resources, such as IDs or endpoints, and can be used by other configurations or modules.
+### Modules Directory
 
-**terraform.tfvars:** Contains actual values for the declared variables. Sensitive values should not be committed to version control, so consider using environment variables or encrypted secrets management for those.
+The `modules/` directory contains reusable Terraform configurations for different infrastructure components.
 
-**backend.tf:** Optionally specifies backend configuration where Terraform state information is stored. This is crucial for team environments or when using Terraform in automation (CI/CD pipelines).
+- **kubectl/**: Manages Kubernetes-related resources, including namespace configurations, service accounts, and Harness Delegate setup.
+- **terraforn-azurerm-aks/**: Handles the deployment of Azure Kubernetes Service (AKS).
+- **vm/**: Contains Terraform configuration for provisioning Virtual Machines.
 
-**versions.tf:** Specifies required versions for Terraform and providers, ensuring consistent behavior across different environments and team members.
+## Usage Instructions
 
-**README.md:** Provides documentation for your project, explaining its purpose, how to use it, and any prerequisites or configuration steps.
+1. **Ensure Terraform and Terragrunt are installed**  
+   - Install Terraform: [Terraform Download](https://www.terraform.io/downloads)
+   - Install Terragrunt: [Terragrunt Installation](https://terragrunt.gruntwork.io/docs/getting-started/install/)
 
-**Modules Directory:** Contains subdirectories for each modularized component of your infrastructure, like networking or compute resources. This allows you to encapsulate and reuse configurations.
+2. **Initialize Terraform/Terragrunt**  
+   ```sh
+   terraform init
+   # OR for Terragrunt
+   terragrunt init
 
 
-Define variables
diff --git a/terraform/deployment/aks/modules/kubectl/harness-delegate-nsconf.yaml b/terraform/deployment/aks/modules/kubectl/harness-delegate-nsconf.yaml
new file mode 100644
index 0000000..e1b730d
--- /dev/null
+++ b/terraform/deployment/aks/modules/kubectl/harness-delegate-nsconf.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: harness-delegate-ng
diff --git a/terraform/deployment/aks/modules/kubectl/namespaces.yaml b/terraform/deployment/aks/modules/kubectl/namespaces.yaml
new file mode 100644
index 0000000..0acae1a
--- /dev/null
+++ b/terraform/deployment/aks/modules/kubectl/namespaces.yaml
@@ -0,0 +1,4 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: dev-ns