Skip to content

Commit 4711587

Browse files
authored
fix: wrong default value for revision_history_limit in argocd_application resource (#161)
1 parent 47ce970 commit 4711587

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

argocd/resource_argocd_application_test.go

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212

1313
func TestAccArgoCDApplication(t *testing.T) {
1414
commonName := acctest.RandomWithPrefix("test-acc")
15+
revisionHistoryLimit := acctest.RandIntRange(0, 9)
1516
helmValues := `
1617
ingress:
1718
enabled: true
@@ -52,6 +53,11 @@ ingress:
5253
"spec.0.source.0.target_revision",
5354
"15.3.0",
5455
),
56+
resource.TestCheckResourceAttr(
57+
"argocd_application.simple",
58+
"spec.0.revision_history_limit",
59+
"10",
60+
),
5561
),
5662
},
5763
{
@@ -213,6 +219,20 @@ ingress:
213219
),
214220
),
215221
},
222+
{
223+
Config: testAccArgoCDApplicationSimpleRevisionHistory(commonName, revisionHistoryLimit),
224+
Check: resource.ComposeTestCheckFunc(
225+
resource.TestCheckResourceAttrSet(
226+
"argocd_application.simple",
227+
"metadata.0.uid",
228+
),
229+
resource.TestCheckResourceAttr(
230+
"argocd_application.simple",
231+
"spec.0.revision_history_limit",
232+
fmt.Sprint(revisionHistoryLimit),
233+
),
234+
),
235+
},
216236
},
217237
})
218238
}
@@ -778,6 +798,48 @@ resource "argocd_application" "simple" {
778798
`, name)
779799
}
780800

801+
func testAccArgoCDApplicationSimpleRevisionHistory(name string, revision_history_limit int) string {
802+
return fmt.Sprintf(`
803+
resource "argocd_application" "simple" {
804+
metadata {
805+
name = "%s"
806+
namespace = "argocd"
807+
labels = {
808+
acceptance = "true"
809+
}
810+
annotations = {
811+
"this.is.a.really.long.nested.key" = "yes, really!"
812+
}
813+
}
814+
815+
spec {
816+
revision_history_limit = %d
817+
source {
818+
repo_url = "https://charts.bitnami.com/bitnami"
819+
chart = "redis"
820+
target_revision = "15.3.0"
821+
helm {
822+
parameter {
823+
name = "image.tag"
824+
value = "6.2.5"
825+
}
826+
parameter {
827+
name = "architecture"
828+
value = "standalone"
829+
}
830+
release_name = "testing"
831+
}
832+
}
833+
834+
destination {
835+
server = "https://kubernetes.default.svc"
836+
namespace = "default"
837+
}
838+
}
839+
}
840+
`, name, revision_history_limit)
841+
}
842+
781843
func testAccSkipFeatureIgnoreDiffJQPathExpressions() (bool, error) {
782844
p, _ := testAccProviders["argocd"]()
783845
_ = p.Configure(context.Background(), &terraform.ResourceConfig{})

argocd/schema_application.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ func applicationSpecSchema() *schema.Schema {
392392
"revision_history_limit": {
393393
Type: schema.TypeInt,
394394
Optional: true,
395+
Default: 10,
395396
},
396397
},
397398
},

0 commit comments

Comments
 (0)