Giter VIP home page Giter VIP logo

cloudflare-create-record's Introduction

Terraform Module: cloudflare-create-record

This Terraform module allows users to create DNS records in Cloudflare. This module is highly reusable and can be easily imported into other Terraform projects for managing Cloudflare DNS records.

Configuration

The module requires the following variables to function properly:

  • domain_name: This is a string variable indicating the name of the Cloudflare domain to manage.
  • dns_records: This is a list of objects representing the DNS records to be managed in Cloudflare. Each object in the list should have name, type, and value. The name is a string representing the name of the record, type is also a string indicating the type of record (e.g., "A", "CNAME", etc.), and value is a string indicating the value associated with the record.

Usage

To use this module in your Terraform configuration, import it with the following HCL code:

terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 4.0"
    }
  }
}

variable "cloudflare_api_token" {
  type = string
  description = "Cloudflare API Token"
  sensitive = true
}

# Configure the Cloudflare
provider "cloudflare" {
  api_token = var.cloudflare_api_token
}

module "dns_management" {
  source  = "git::https://github.com/rubenqba/cloudflare-create-record.git"
  domain_name  = "${var.domain_name}"
  dns_records  = [
    {
      name = "www"
      type = "A"
      value = "192.0.2.1"
    },
    {
      name = "api"
      type = "CNAME"
      value = "api.mysite.net"
    }
  ]
}

Replace ${var.cloudflare_api_token} with your Cloudflare API token and ${var.domain_name} with your domain name. Also, modify dns_records to match the records you want to manage.

After setting up, you can run terraform apply to create or manage your DNS records in the Cloudflare account.

Output

After running terraform apply, the module will output a list of objects representing the DNS records that have been managed. The output might look like the following example:

records = [
  {
    "fqdn" = "www.your-domain-name.com"
    "name" = "www"
    "type" = "A"
  },
  {
    "fqdn" = "api.your-domain-name.com"
    "name" = "api"
    "type" = "CNAME"
  },
]

Each object will provide the name, type, and fqdn of the DNS record.

Note

Please ensure your Cloudflare authentication credentials are correctly set up before using this module.

This module is intended to be used with the latest version of Terraform. If you are using an earlier version of Terraform, some functionalities might not work properly.

cloudflare-create-record's People

Contributors

rubenqba avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.