Terraform is a declarative way of setting up your cloud infrastructure. You specify the state you want your cloud to be in. Ansible is an imperative way of setting up your cloud. You tell it to do certain things, install this package, copy this over there. Hope it helps
Ansible is mostly declarative. by default you use Ansible modules/roles and specify the desired state. E.g. have these packages installed, have these directories created/deleted. Use cases not covered by modules can fallback to using shell commands
If I could add to your answer:
Not only is ansible declarative and idempotent but it also includes countless cloud provisioning modules to bring idempotency to cloud environments.
Terraform may be easier for basic provisioning of cloud resources but I always switch back to ansible cloud modules when I need to do anything complex. Ansible also has the added benefit of easily context switching over to configuring the compute resources after they have launched.