Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement data source for G Suite mail servers #14021

Closed
gnarea opened this issue Apr 26, 2017 · 3 comments
Closed

Implement data source for G Suite mail servers #14021

gnarea opened this issue Apr 26, 2017 · 3 comments

Comments

@gnarea
Copy link

gnarea commented Apr 26, 2017

It'd be great if there were a data source for the mail servers from Google's G Suite (Gmail). It could be used as follows:

data "google_gsuite_mail_servers" "main" {}

resource "cloudflare_record" "mx" {
  count = "${length(data.google_gsuite_mail_servers.domains)}"

  domain = "example.com"
  name = "@"
  value = "${data.google_gsuite_mail_servers.domains[count.index]}"
  priority = "${count.index + 1}"
  type = "MX"
}

I don't think Google offer a machine-friendly way to fetch the mail servers, but the values haven't changed in years: aspmx.l.google.com, alt1.aspmx.l.google.com, alt2.aspmx.l.google.com, alt3.aspmx.l.google.com, alt4.aspmx.l.google.com.

I've implemented this functionality as a module for the time being: https://github.com/gnarea/terraform-gmail

@gregsymons
Copy link

The machine-friendly way to look up the mail servers is to do an MX lookup on google.com or gmail.com:

$ host -t mx google.com
google.com mail is handled by 20 alt1.aspmx.l.google.com.
google.com mail is handled by 30 alt2.aspmx.l.google.com.
google.com mail is handled by 40 alt3.aspmx.l.google.com.
google.com mail is handled by 50 alt4.aspmx.l.google.com.
google.com mail is handled by 10 aspmx.l.google.com.
$ host -t mx gmail.com
gmail.com mail is handled by 30 alt3.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 40 alt4.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 5 gmail-smtp-in.l.google.com.
gmail.com mail is handled by 10 alt1.gmail-smtp-in.l.google.com.
gmail.com mail is handled by 20 alt2.gmail-smtp-in.l.google.com.

If you resolve the gmail-smtp-in hosts, they're the same as the aspmx hosts.

@paultyng
Copy link
Contributor

This issue should probably be opened on one of the community GSuite providers:

@ghost
Copy link

ghost commented Apr 1, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@hashicorp hashicorp locked and limited conversation to collaborators Apr 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants