Skip to content

Commit e7e2517

Browse files
Add backtracking and new SonarQube installation
1 parent e273c2e commit e7e2517

File tree

7 files changed

+31
-19
lines changed

7 files changed

+31
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ No modules.
8484
|------|-------------|------|---------|:--------:|
8585
| <a name="input_chart_version"></a> [chart\_version](#input\_chart\_version) | Version of the Jenkins chart that will be used to deploy Jenkins application. | `string` | `"2025.2.0"` | no |
8686
| <a name="input_namespace"></a> [namespace](#input\_namespace) | Name of the Kubernetes namespace where the Jenkins deployment will be deployed. | `string` | `"sonarqube"` | no |
87-
| <a name="input_sonarqube_config"></a> [sonarqube\_config](#input\_sonarqube\_config) | Specify the configuration settings for Sonarqube, including the hostname, storage options, and custom YAML values. | `any` | <pre>{<br/> "grafana_monitoring_enabled": false,<br/> "hostname": "",<br/> "postgresql_external_server_url": "",<br/> "postgresql_password_external": "",<br/> "postgresql_volume_size": "",<br/> "sonarqube_volume_size": "",<br/> "storage_class_name": "",<br/> "values_yaml": ""<br/>}</pre> | no |
87+
| <a name="input_sonarqube_config"></a> [sonarqube\_config](#input\_sonarqube\_config) | Specify the configuration settings for Sonarqube, including the hostname, storage options, and custom YAML values. | `any` | <pre>{<br/> "grafana_monitoring_enabled": false,<br/> "hostname": "",<br/> "postgresql_external_server_url": "",<br/> "postgresql_password_external": "",<br/> "postgresql_volume_size": "",<br/> "sonarqube_volume_size": "",<br/> "storage_class_name": "",<br/> "updateExistingSonarqube": false,<br/> "values_yaml": ""<br/>}</pre> | no |
8888

8989
## Outputs
9090

examples/complete/aws/main.tf

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
2-
name = ""
3-
region = ""
4-
environment = ""
2+
name = "test"
3+
region = "ap-south-1"
4+
environment = "squareops"
55
additional_tags = {
66
Owner = "organization_name"
77
Expires = "Never"
@@ -19,10 +19,13 @@ module "sonarqube" {
1919
sonarqube_volume_size = "5Gi"
2020
postgresql_volume_size = "10Gi"
2121
grafana_monitoring_enabled = false
22-
monitoringPasscode = "xxxxxxx"
23-
sonarqube_current_password = "xxxxxxx" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
24-
postgresql_current_password = "xxxxxxxxxxx" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
22+
monitoringPasscode = ""
2523
postgresql_password_external = ""
2624
postgresql_external_server_url = ""
25+
sonarqube_password = ""
26+
27+
updateExistingSonarqube = true
28+
sonarqube_current_password = "orWZVlhIXZvD3W4RXA7h" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
29+
postgresql_current_password = "ZIMOR6c3joeYJvAyVUnu" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
2730
}
2831
}

examples/complete/aws/provider.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ provider "aws" {
66
}
77

88
data "aws_eks_cluster" "cluster" {
9-
name = ""
9+
name = "stage-sqops"
1010
}
1111

1212
data "aws_eks_cluster_auth" "cluster" {
13-
name = ""
13+
name = "stage-sqops"
1414
}
1515

1616

examples/complete/azure/main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ module "sonarqube" {
1919
sonarqube_volume_size = "5Gi"
2020
postgresql_volume_size = "10Gi"
2121
grafana_monitoring_enabled = false
22-
monitoringPasscode = "xxxxxxx"
23-
sonarqube_current_password = "xxxxxxx" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
24-
postgresql_current_password = "xxxxxxxxxxx" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
22+
monitoringPasscode = ""
2523
postgresql_password_external = ""
2624
postgresql_external_server_url = ""
25+
sonarqube_password = ""
26+
27+
updateExistingSonarqube = true
28+
sonarqube_current_password = "orWZVlhIXZvD3W4RXA7h" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
29+
postgresql_current_password = "ZIMOR6c3joeYJvAyVUnu" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
2730
}
2831
}

examples/complete/gcp/main.tf

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,13 @@ module "sonarqube" {
1919
sonarqube_volume_size = "5Gi"
2020
postgresql_volume_size = "10Gi"
2121
grafana_monitoring_enabled = false
22-
monitoringPasscode = "xxxxxxx"
23-
sonarqube_current_password = "xxxxxxx" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
24-
postgresql_current_password = "xxxxxxxxxxx" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
22+
monitoringPasscode = ""
2523
postgresql_password_external = ""
2624
postgresql_external_server_url = ""
25+
sonarqube_password = ""
26+
27+
updateExistingSonarqube = true
28+
sonarqube_current_password = "orWZVlhIXZvD3W4RXA7h" # if you upgrade sonarqube then you have to provide your previous sonarqube password ##Secret name=sonarqube-postgresql
29+
postgresql_current_password = "ZIMOR6c3joeYJvAyVUnu" # if you upgrade sonarqube then you have to provide your previous postgresql password ##Secret name=sonarqube-sonarqube-admin-password
2730
}
2831
}

main.tf

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ resource "helm_release" "sonarqube" {
3434
volume_size = var.sonarqube_config.sonarqube_volume_size
3535
sonarqube_sc = var.sonarqube_config.storage_class_name
3636
postgresql_enable = var.sonarqube_config.postgresql_external_server_url != "" ? false : true
37-
sonarqube_password = random_password.sonarqube_password.result
38-
sonarqube_current_password = var.sonarqube_config.sonarqube_current_password
39-
postgresql_password = var.sonarqube_config.postgresql_current_password != "" ? var.sonarqube_config.postgresql_current_password : random_password.postgresql_password.result
37+
sonarqube_password = var.sonarqube_config.sonarqube_password != "" ? var.sonarqube_config.sonarqube_password : random_password.sonarqube_password.result
38+
sonarqube_current_password = var.sonarqube_config.updateExistingSonarqube == true ? var.sonarqube_config.sonarqube_current_password : "admin"
39+
postgresql_password = var.sonarqube_config.postgresql_current_password != "" && var.sonarqube_config.updateExistingSonarqube == true ? var.sonarqube_config.postgresql_current_password : random_password.postgresql_password.result
4040
postgresql_disk_size = var.sonarqube_config.postgresql_volume_size
4141
prometheus_exporter_enable = var.sonarqube_config.grafana_monitoring_enabled
42-
postgresql_password_external = var.sonarqube_config.postgresql_password_external
4342
postgresql_external_server_url = var.sonarqube_config.postgresql_external_server_url
43+
postgresql_password_external = var.sonarqube_config.postgresql_password_external
4444

4545
}),
4646
var.sonarqube_config.values_yaml
@@ -62,6 +62,7 @@ resource "helm_release" "sonarqube" {
6262
}
6363
}
6464
resource "kubernetes_manifest" "migration_job" {
65+
count = var.sonarqube_config.updateExistingSonarqube ? 1 : 0
6566
manifest = {
6667
apiVersion = "batch/v1"
6768
kind = "Job"

variables.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ variable "sonarqube_config" {
99
grafana_monitoring_enabled = false
1010
postgresql_password_external = ""
1111
postgresql_external_server_url = ""
12+
updateExistingSonarqube = false
1213
}
1314
description = "Specify the configuration settings for Sonarqube, including the hostname, storage options, and custom YAML values."
1415
}
@@ -19,6 +20,7 @@ variable "chart_version" {
1920
description = "Version of the Jenkins chart that will be used to deploy Jenkins application."
2021
}
2122

23+
2224
variable "namespace" {
2325
type = string
2426
default = "sonarqube"

0 commit comments

Comments
 (0)