File tree Expand file tree Collapse file tree
examples/data-sources/diff Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Deploy initial release with specific configuration
2+ resource "helm_release" "mariadb" {
3+ name = " mariadb-instance"
4+ namespace = " default"
5+ repository = " https://charts.helm.sh/stable"
6+
7+ chart = " mariadb"
8+ version = " 7.1.0"
9+
10+ set {
11+ name = " service.port"
12+ value = " 13306"
13+ }
14+
15+ set {
16+ name = " replication.enabled"
17+ value = " false"
18+ }
19+ }
20+
21+ # Check what would change if we modify the configuration
22+ data "helm_diff" "mariadb_upgrade" {
23+ name = " mariadb-instance"
24+ namespace = " default"
25+ repository = " https://charts.helm.sh/stable"
26+
27+ chart = " mariadb"
28+ version = " 7.1.0" # Same version
29+
30+ set = [
31+ {
32+ name = " service.port"
33+ value = " 3306"
34+ },
35+ {
36+ name = " replication.enabled"
37+ value = " true"
38+ }
39+ ]
40+
41+ depends_on = [helm_release . mariadb ]
42+ }
43+
44+ output "has_changes" {
45+ description = " Whether the proposed config differs from deployed"
46+ value = data. helm_diff . mariadb_upgrade . has_changes
47+ }
48+
49+ output "what_will_change" {
50+ description = " Detailed diff of configuration changes"
51+ value = data. helm_diff . mariadb_upgrade . diff
52+ }
53+
54+ output "changes_json" {
55+ description = " JSON structure showing modified resources"
56+ value = data. helm_diff . mariadb_upgrade . diff_json
57+ }
Original file line number Diff line number Diff line change 1+ data "helm_diff" "mariadb_instance" {
2+ name = " mariadb-instance"
3+ namespace = " default"
4+ repository = " https://charts.helm.sh/stable"
5+
6+ chart = " mariadb"
7+ version = " 7.1.0"
8+
9+ set = [
10+ {
11+ name = " service.port"
12+ value = " 13306"
13+ }
14+ ]
15+
16+ set_sensitive = [
17+ {
18+ name = " rootUser.password"
19+ value = " s3cr3t!"
20+ }
21+ ]
22+ }
23+
24+
25+ output "has_changes" {
26+ value = data. helm_diff . mariadb_instance . has_changes
27+ }
28+
29+ output "diff_output" {
30+ value = data. helm_diff . mariadb_instance . diff
31+ }
32+
33+ output "current_manifest" {
34+ value = data. helm_diff . mariadb_instance . current_manifest
35+ }
36+
37+ output "proposed_manifest" {
38+ value = data. helm_diff . mariadb_instance . proposed_manifest
39+ }
You can’t perform that action at this time.
0 commit comments