I'm sorry, but the provided knowledge sources do not contain any information or examples related to writing Terraform code for creating an application and saving the client id and client secret to the Terraform data state. I recommend referring to the Terraform documentation or other relevant resources for this information.