|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "contentstack_global_field Resource - terraform-provider-contentstack" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + A Global field is a reusable field (or group of fields) that you can |
| 7 | + define once and reuse in any content type within your stack. This |
| 8 | + eliminates the need (and thereby time and efforts) to create the same |
| 9 | + set of fields repeatedly in multiple content types. |
| 10 | +--- |
| 11 | + |
| 12 | +# contentstack_global_field (Resource) |
| 13 | + |
| 14 | +A Global field is a reusable field (or group of fields) that you can |
| 15 | + define once and reuse in any content type within your stack. This |
| 16 | + eliminates the need (and thereby time and efforts) to create the same |
| 17 | + set of fields repeatedly in multiple content types. |
| 18 | + |
| 19 | +## Example Usage |
| 20 | + |
| 21 | +```terraform |
| 22 | +terraform { |
| 23 | + required_providers { |
| 24 | + contentstack = { |
| 25 | + source = "labd/contentstack" |
| 26 | + } |
| 27 | + } |
| 28 | +} |
| 29 | +
|
| 30 | +provider "contentstack" { |
| 31 | + base_url = "https://eu-api.contentstack.com/" |
| 32 | + api_key = "<api_key>" |
| 33 | + management_token = "<token>" |
| 34 | +} |
| 35 | +
|
| 36 | +
|
| 37 | +resource "contentstack_global_field" "my_field" { |
| 38 | + title = "test something" |
| 39 | + uid = "foobar" |
| 40 | + description = "someting" |
| 41 | + maintain_revisions = true |
| 42 | +
|
| 43 | + schema = jsonencode(jsondecode(<<JSON |
| 44 | + [ |
| 45 | + { |
| 46 | + "display_name": "Name", |
| 47 | + "uid": "name", |
| 48 | + "multiple": false, |
| 49 | + "non_localizable": false, |
| 50 | + "unique": false, |
| 51 | + "mandatory": false, |
| 52 | + "data_type": "text" |
| 53 | + }, |
| 54 | + { |
| 55 | + "data_type": "text", |
| 56 | + "display_name": "Rich text editor", |
| 57 | + "uid": "description", |
| 58 | + "field_metadata": { |
| 59 | + "allow_rich_text": true, |
| 60 | + "description": "foobar", |
| 61 | + "multiline": false, |
| 62 | + "rich_text_type": "advanced", |
| 63 | + "options": [], |
| 64 | + "version": 3 |
| 65 | + }, |
| 66 | + "multiple": false, |
| 67 | + "non_localizable": false, |
| 68 | + "mandatory": false, |
| 69 | + "unique": false |
| 70 | + } |
| 71 | + ] |
| 72 | +JSON |
| 73 | + )) |
| 74 | +} |
| 75 | +``` |
| 76 | + |
| 77 | +<!-- schema generated by tfplugindocs --> |
| 78 | +## Schema |
| 79 | + |
| 80 | +### Required |
| 81 | + |
| 82 | +- `title` (String) |
| 83 | +- `uid` (String) |
| 84 | + |
| 85 | +### Optional |
| 86 | + |
| 87 | +- `description` (String) |
| 88 | +- `maintain_revisions` (Boolean) |
| 89 | +- `schema` (String) The schema as JSON. Use jsonencode(jsonecode(<schema>)) to work around wrong changes. |
| 90 | + |
| 91 | + |
0 commit comments