Difference between revisions of "Terraform Cloudflare provider"

From wikieduonline
Jump to navigation Jump to search
Line 3: Line 3:
 
== Examples ==
 
== Examples ==
 
Official:
 
Official:
 +
 +
# Configure the Cloudflare provider using the required_providers stanza
 +
# required with Terraform 0.13 and beyond. You may optionally use version
 +
# directive to prevent breaking changes occurring unannounced.
 +
terraform {
 +
  [[required_providers]] {
 +
    cloudflare = {
 +
      source  = "cloudflare/cloudflare"
 +
      version = "~> 4.0"
 +
    }
 +
  }
 +
}
 
<pre>
 
<pre>
# Configure the Cloudflare provider using the required_providers stanza
 
# required with Terraform 0.13 and beyond. You may optionally use version
 
# directive to prevent breaking changes occurring unannounced.
 
terraform {
 
  required_providers {
 
    cloudflare = {
 
      source  = "cloudflare/cloudflare"
 
      version = "~> 4.0"
 
    }
 
  }
 
}
 
 
 
provider "cloudflare" {
 
provider "cloudflare" {
 
   api_token = var.cloudflare_api_token
 
   api_token = var.cloudflare_api_token
Line 30: Line 30:
 
}
 
}
 
</pre>
 
</pre>
 
 
  
 
== See also ==
 
== See also ==

Revision as of 20:00, 6 February 2024

https://registry.terraform.io/providers/cloudflare/cloudflare/latest/docs

Examples

Official:

# Configure the Cloudflare provider using the required_providers stanza
# required with Terraform 0.13 and beyond. You may optionally use version
# directive to prevent breaking changes occurring unannounced.
terraform {
  required_providers {
    cloudflare = {
      source  = "cloudflare/cloudflare"
      version = "~> 4.0"
    }
  }
}
provider "cloudflare" {
  api_token = var.cloudflare_api_token
}

# Create a record
resource "cloudflare_record" "www" {
  # ...
}

# Create a page rule
resource "cloudflare_page_rule" "www" {
  # ...
}

See also

Advertising: