resource gmailfilter_filter "example" {
criteria {
# exclude_chats = false
from = "[email protected]"
# has_attachment = false
# negated_query = "from:[email protected] rfc822msgid: is:unread"
# query = "from:[email protected] rfc822msgid: is:unread"
# size = 1000
# size_comparison = "larger"
# subject = "example"
# to = "example@"
}
action {
add_label_ids = [gmailfilter_label.example.id]
remove_label_ids = [data.gmailfilter_label.INBOX.id]
}
}
data gmailfilter_label "INBOX" {
name = "INBOX"
}
resource gmailfilter_label "example" {
name = "example"
}
To install the provider plugin, please see the Terraform documentation. The plugin executables can download from Releases.
Follow the instruction at Enable and disable APIs to enable to the Gmail APIs.
There are two authentication methods available with this provider.
Follow the instruction at https://developers.google.com/identity/protocols/oauth2/service-account#creatinganaccount.
Then, add credentials and impersonated_user_email to your tf file.
provider gmailfilter {
credentials = file("account.json")
impersonated_user_email = "[email protected]"
}
You can also use these environment variables:
GOOGLE_APPLICATION_CREDENTIALSGOOGLE_CREDENTIALSGOOGLE_CLOUD_KEYFILE_JSONGCLOUD_KEYFILE_JSONIMPERSONATED_USER_EMAILFirst, you need to create credentials for the project.
https://console.cloud.google.com/apis/credentials?project=[project_ID]
Then, create an OAuth 2.0 client, and download the client secret file(JSON) to your local machine.
Finally, run the following command to use that credential to authenticate.
gcloud auth application-default login \
--client-id-file=client_secret.json \
--scopes \
https://www.googleapis.com/auth/gmail.labels,\
https://www.googleapis.com/auth/gmail.settings.basic
Terraformer includes support for this provider and can generate Terraform files from your existing infrastructure.
See the Terraformer README for more information.
Currently, the provider doesn't support managing the forwarding addresses.
If you want to use forwarding in the gmailfilter_filter resource, please configure the forwarding addresses manually before using it.
For details, see Automatically forward Gmail messages to another account.
terraform-proivder-gmailfilter Copyright (C) 2020 terraform-provider-gmailfilter authors.
This project is published under Mozilla Public License 2.0.
Content type
Image
Digest
Size
35.4 MB
Last updated
about 5 years ago
docker pull yamamotofebc/terraform-provider-gmailfilter