Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kitagry/terraform-provider-contentful
Terraform provider for Contentful
https://github.com/kitagry/terraform-provider-contentful
Last synced: 13 days ago
JSON representation
Terraform provider for Contentful
- Host: GitHub
- URL: https://github.com/kitagry/terraform-provider-contentful
- Owner: kitagry
- License: mit
- Created: 2022-07-27T02:28:33.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-19T12:31:20.000Z (about 1 year ago)
- Last Synced: 2024-06-20T22:38:23.447Z (5 months ago)
- Language: Go
- Homepage:
- Size: 227 KB
- Stars: 0
- Watchers: 0
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
![Go](https://github.com/kitagry/terraform-provider-contentful/actions/workflows/test.yaml/badge.svg)
[![codecov](https://coveralls.io/repos/github/kitagry/terraform-provider-contentful/badge.svg?branch=main)](https://coveralls.io/github/kitagry/terraform-provider-contentful?branch=main)
[![license](https://img.shields.io/github/license/kitagry/terraform-provider-contentful.svg)](https://github.com/kitagry/terraform-provider-contentful/blob/master/LICENSE)Terraform Provider for [Contentful's](https://www.contentful.com) Content Management API
# About
[Contentful](https://www.contentful.com) provides a content infrastructure for digital teams to power content in websites, apps, and devices. Unlike a CMS, Contentful was built to integrate with the modern software stack. It offers a central hub for structured content, powerful management and delivery APIs, and a customizable web app that enable developers and content creators to ship digital products faster.
[Terraform](https://www.terraform.io) is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions.
# Features
Create, update and delete Contentful resources such as:
- [x] Spaces
- [x] Content Types
- [x] API Keys
- [x] Webhooks
- [x] Locales
- [x] Environments
- [x] Entries
- [x] Assets# Getting started
Download [go](https://golang.org/dl) for your platform.
Follow the [Install the Go tools](https://golang.org/doc/install#install) instructions.
Download [terraform](https://www.terraform.io/downloads.html) for your platform.
Follow the [Installing Terraform](https://www.terraform.io/intro/getting-started/install.html) instructions.
Create a directory where your terraform files and states will be placed. Although not mandatory this should be placed under a version control software such as [git](https://git-scm.com).
Make sure you have your Content Management API Token and the organization ID before starting. As an alternative to configuring the provider in the terraform file you can also set environment variables.
```sh
# For Linux/Mac OS
export CONTENTFUL_ORGANIZATION_ID=
export CONTENTFUL_MANAGEMENT_TOKEN=
``````
REM For Windows
setx CONTENTFUL_ORGANIZATION_ID ""
setx CONTENTFUL_MANAGEMENT_TOKEN ""
```# Using the provider
Build the binary$ go build -o terraform-provider-contentful
*Or using make command*
$ make build
Add it to your ~/.terraformrc (or %APPDATA%/terraform.rc for Windows)
$ cat ~/.terraformrc
providers {
contentful = "/terraform-provider-contentful"
}Use the provider by creating a main.tf file with:
provider "contentful" {
cma_token = ""
organization_id = ""
}
resource "contentful_space" "test" {
name = "my-update-space-name"
}Run the terraform plan
$ terraform plan -out=contentful.plan
Check the changes
```
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.The Terraform execution plan has been generated and is shown below.
Resources are shown in alphabetical order for quick scanning. Green resources
will be created (or destroyed and then created if an existing resource
exists), yellow resources are being changed in-place, and red resources
will be destroyed. Cyan entries are data sources to be read.Your plan was also saved to the path below. Call the "apply" subcommand
with this plan file and Terraform will exactly execute this execution
plan.Path: contentful.plan
+ contentful_space.test
default_locale: "en"
name: "my-update-space-name"
version: ""Plan: 1 to add, 0 to change, 0 to destroy.
```Apply the plan
$ terraform apply
Check the Terraform output for warnings and errors
```
contentful_space.test: Creating...
default_locale: "" => "en"
name: "" => "my-update-space-name"
version: "" => ""
contentful_space.test: Creation complete (ID: yculypygam9h)Apply complete! Resources: 1 added, 0 changed, 0 destroyed.
The state of your infrastructure has been saved to the path
below. This state is required to modify and destroy your
infrastructure, so keep it safe. To inspect the complete state
use the `terraform show` command.State path:
```## Testing
$ TF_ACC=1 go test -v
To enable higher verbose mode:
$ TF_LOG=debug TF_ACC=1 go test -v
For testing, you can also make use of the make command:
$ make test-unit
## Documentation/References
### Hashicorp
[Terraform plugins](https://www.terraform.io/docs/plugins/basics.html)[Writing custom terraform providers](https://www.hashicorp.com/blog/writing-custom-terraform-providers)
### Other references
Julien Fabre: [Writing a Terraform provider](http://blog.jfabre.net/2017/01/22/writing-terraform-provider)## Support
If you have a problem with this provider, please file an [issue](https://github.com/kitagry/terraform-provider-contentful/issues/new) here on Github.
## License
MIT