Creating a zone using a shared/admin account

We are using Terraform to create our DNS zones, and A/CNAME records. I’m able to successfully use my users “Global API Key” to create the resources, however, others can’t see it. Turns out the resources are being created underneath my account, and not the company account. How would we specify the account to create the zone in? Is it based on the API key?

Thinking this over with the team, we do not want anything owned by a specific person (in case someone were to leave the company, we would need to associate resources to another account). Does Cloudflare have the concept of a shared service account user?

Here is my Terraform code:

terraform {
  backend "s3" {
    bucket         = "terraform"
    dynamodb_table = "terraform"
    encrypt        = true
    key            = "cloudflare/donovan.com/terraform.tfstate"
    profile        = "production"
    region         = "us-east-1"
  }
}

provider "aws" {
  profile = "production"
  version = "~> 2.0"
}

provider "cloudflare" {
  email = "[email protected]"
  token = "REDACTED"
}

# create zone

resource "cloudflare_zone" "main" {
  zone = "donovan.com"
}

# create individual record(s)

resource "cloudflare_record" "dev" {
  depends_on = [cloudflare_zone.main]

  domain = "donovan.com" # zone for some reason
  name   = "dev"
  value  = "192.168.0.1"
  type   = "A"
  ttl    = 3600
}

This topic was automatically closed after 31 days. New replies are no longer allowed.