Skip to content

Commit e634913

Browse files
Add support for templatePatch (#499)
* fix test Signed-off-by: AvivGuiser <[email protected]> * ran make generate Signed-off-by: AvivGuiser <[email protected]> * fix tests by guarding the templatePatch behined a feature Signed-off-by: AvivGuiser <[email protected]> * fix test in 2.9 Signed-off-by: AvivGuiser <[email protected]> --------- Signed-off-by: AvivGuiser <[email protected]> Co-authored-by: Nathanael Liechti <[email protected]>
1 parent f8a0cdd commit e634913

File tree

7 files changed

+331
-227
lines changed

7 files changed

+331
-227
lines changed

GNUmakefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ARGOCD_INSECURE?=true
44
ARGOCD_SERVER?=127.0.0.1:8080
55
ARGOCD_AUTH_USERNAME?=admin
66
ARGOCD_AUTH_PASSWORD?=acceptancetesting
7-
ARGOCD_VERSION?=v2.9.3
7+
ARGOCD_VERSION?=v2.11.9
88

99
export
1010

@@ -39,4 +39,4 @@ testacc_prepare_env:
3939
clean:
4040
git clean -fXd -e \!vendor -e \!vendor/**/* -e \!.vscode
4141

42-
.PHONY: build install lint generate fmt test testacc testacc_clean_env testacc_prepare_env clean
42+
.PHONY: build install lint generate fmt test testacc testacc_clean_env testacc_prepare_env clean

argocd/resource_argocd_application_set.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func resourceArgoCDApplicationSetCreate(ctx context.Context, d *schema.ResourceD
4141
return featureNotSupported(features.ApplicationSet)
4242
}
4343

44-
objectMeta, spec, err := expandApplicationSet(d, si.IsFeatureSupported(features.MultipleApplicationSources), si.IsFeatureSupported(features.ApplicationSetIgnoreApplicationDifferences))
44+
objectMeta, spec, err := expandApplicationSet(d, si.IsFeatureSupported(features.MultipleApplicationSources), si.IsFeatureSupported(features.ApplicationSetIgnoreApplicationDifferences), si.IsFeatureSupported(features.ApplicationSetTemplatePatch))
4545
if err != nil {
4646
return errorToDiagnostics("failed to expand application set", err)
4747
}
@@ -58,6 +58,10 @@ func resourceArgoCDApplicationSetCreate(ctx context.Context, d *schema.ResourceD
5858
return featureNotSupported(features.ApplicationSetApplicationsSyncPolicy)
5959
}
6060

61+
if !si.IsFeatureSupported(features.ApplicationSetTemplatePatch) && spec.TemplatePatch != nil {
62+
return featureNotSupported(features.ApplicationSetTemplatePatch)
63+
}
64+
6165
as, err := si.ApplicationSetClient.Create(ctx, &applicationset.ApplicationSetCreateRequest{
6266
Applicationset: &application.ApplicationSet{
6367
ObjectMeta: objectMeta,
@@ -126,7 +130,7 @@ func resourceArgoCDApplicationSetUpdate(ctx context.Context, d *schema.ResourceD
126130
return nil
127131
}
128132

129-
objectMeta, spec, err := expandApplicationSet(d, si.IsFeatureSupported(features.MultipleApplicationSources), si.IsFeatureSupported(features.ApplicationSetIgnoreApplicationDifferences))
133+
objectMeta, spec, err := expandApplicationSet(d, si.IsFeatureSupported(features.MultipleApplicationSources), si.IsFeatureSupported(features.ApplicationSetIgnoreApplicationDifferences), si.IsFeatureSupported(features.ApplicationSetTemplatePatch))
130134
if err != nil {
131135
return errorToDiagnostics(fmt.Sprintf("failed to expand application set %s", d.Id()), err)
132136
}

0 commit comments

Comments
 (0)