Skip to content

Commit fac513d

Browse files
Fix wait on update of argocd_application (#246)
Co-authored-by: Olivier Boukili <[email protected]>
1 parent b9e97db commit fac513d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

argocd/resource_argocd_application.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func resourceArgoCDApplication() *schema.Resource {
3131
"spec": applicationSpecSchemaV4(),
3232
"wait": {
3333
Type: schema.TypeBool,
34-
Description: "Upon application creation or update, wait for application health/sync status to be healthy/Synced, upon application deletion, wait for application to be removed, when set to true. Wait timeouts are controlled by Terraform Create, Update and Delete resource timeouts (all default to 5 minutes).",
34+
Description: "Upon application creation or update, wait for application health/sync status to be healthy/Synced, upon application deletion, wait for application to be removed, when set to true. Wait timeouts are controlled by Terraform Create, Update and Delete resource timeouts (all default to 5 minutes). **Note**: if ArgoCD decides not to sync an application (e.g. because the project to which the application belongs has a `sync_window` applied) then you will experience an expected timeout event if `wait = true`.",
3535
Optional: true,
3636
Default: false,
3737
},
@@ -501,6 +501,10 @@ func resourceArgoCDApplicationUpdate(ctx context.Context, d *schema.ResourceData
501501
return resource.NonRetryableError(fmt.Errorf("found multiple applications matching name '%s' and namespace '%s'", *appQuery.Name, *appQuery.AppNamespace))
502502
}
503503

504+
if list.Items[0].Status.ReconciledAt.Equal(apps.Items[0].Status.ReconciledAt) {
505+
return resource.RetryableError(fmt.Errorf("reconciliation has not begun"))
506+
}
507+
504508
if list.Items[0].Status.Health.Status != health.HealthStatusHealthy {
505509
return resource.RetryableError(fmt.Errorf("expected application health status to be healthy but was %s", list.Items[0].Status.Health.Status))
506510
}

docs/resources/application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ resource "argocd_application" "helm" {
145145

146146
- `cascade` (Boolean) Whether to applying cascading deletion when application is removed.
147147
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))
148-
- `wait` (Boolean) Upon application creation or update, wait for application health/sync status to be healthy/Synced, upon application deletion, wait for application to be removed, when set to true. Wait timeouts are controlled by Terraform Create, Update and Delete resource timeouts (all default to 5 minutes).
148+
- `wait` (Boolean) Upon application creation or update, wait for application health/sync status to be healthy/Synced, upon application deletion, wait for application to be removed, when set to true. Wait timeouts are controlled by Terraform Create, Update and Delete resource timeouts (all default to 5 minutes). **Note**: if ArgoCD decides not to sync an application (e.g. because the project to which the application belongs has a `sync_window` applied) then you will experience an expected timeout event if `wait = true`.
149149

150150
### Read-Only
151151

0 commit comments

Comments
 (0)