github.com/danp/terraform@v0.9.5-0.20170426144147-39d740081351/website/source/docs/enterprise/api/configurations.html.md (about) 1 --- 2 layout: "enterprise" 3 page_title: "Configurations - API - Terraform Enterprise" 4 sidebar_current: "docs-enterprise-api-configurations" 5 description: |- 6 A configuration represents settings associated with a resource that runs 7 Terraform with versions of Terraform configuration. 8 --- 9 10 # Configuration API 11 12 A configuration version represents versions of Terraform configuration. Each set 13 of changes to Terraform HCL files or the scripts used in the files should have 14 an associated configuration version. 15 16 When creating versions via the API, the variables attribute can be sent to 17 include the necessary variables for the Terraform configuration. A configuration 18 represents settings associated with a resource that runs Terraform with versions 19 of Terraform configuration. Configurations have many configuration versions 20 which represent versions of Terraform configuration templates and other 21 associated configuration. Most operations take place on the configuration 22 version, not the configuration. 23 24 ## Get Latest Configuration Version 25 26 This endpoint gets the latest configuration version. 27 28 | Method | Path | 29 | :----- | :------------- | 30 | `GET` | `/terraform/configurations/:username/:name/versions/latest` | 31 32 ### Parameters 33 34 - `:username` `(string: <required>)` - Specifies the username or organization 35 name under which to get the latest configuration version. This username must 36 already exist in the system, and the user must have permission to create new 37 configuration versions under this namespace. This is specified as part of the 38 URL. 39 40 - `:name` `(string: <required>)` - Specifies the name of the configuration for 41 which to get the latest configuration. This is specified as part of the URL. 42 43 ### Sample Request 44 45 ```text 46 $ curl \ 47 --header "X-Atlas-Token: ..." \ 48 https://atlas.hashicorp.com/api/v1/terraform/configurations/my-organization/my-configuration/versions/latest 49 ``` 50 51 ### Sample Response 52 53 ```json 54 { 55 "version": { 56 "version": 6, 57 "metadata": { 58 "foo": "bar" 59 }, 60 "tf_vars": [], 61 "variables": {} 62 } 63 } 64 ``` 65 66 - `version` `(int)` - the unique version instance number. 67 68 - `metadata` `(map<string|string>)` - a map of arbitrary metadata for this 69 version. 70 71 ## Create Configuration Version 72 73 This endpoint creates a new configuration version. 74 75 | Method | Path | 76 | :----- | :------------- | 77 | `POST` | `/terraform/configurations/:username/:name/versions` | 78 79 ### Parameters 80 81 - `:username` `(string: <required>)` - Specifies the username or organization 82 name under which to create this configuration version. This username must 83 already exist in the system, and the user must have permission to create new 84 configuration versions under this namespace. This is specified as part of the 85 URL. 86 87 - `:name` `(string: <required>)` - Specifies the name of the configuration for 88 which to create a new version. This is specified as part of the URL. 89 90 - `metadata` `(map<string|string>)` - Specifies an arbitrary hash of key-value 91 metadata pairs. This is specified as the payload as JSON. 92 93 - `variables` `(map<string|string>)` - Specifies a hash of key-value pairs that 94 will be made available as variables to this version. 95 96 ### Sample Payload 97 98 ```json 99 { 100 "version": { 101 "metadata": { 102 "git_branch": "master", 103 "remote_type": "atlas", 104 "remote_slug": "hashicorp/atlas" 105 }, 106 "variables": { 107 "ami_id": "ami-123456", 108 "target_region": "us-east-1", 109 "consul_count": "5", 110 "consul_ami": "ami-123456" 111 } 112 } 113 } 114 ``` 115 116 ### Sample Request 117 118 ```text 119 $ curl \ 120 --request POST \ 121 --header "X-Atlas-Token: ..." \ 122 --header "Content-Type: application/json" \ 123 --data @payload.json \ 124 https://atlas.hashicorp.com/api/v1/terraform/configurations/my-organization/my-configuration/versions 125 ``` 126 127 ### Sample Response 128 129 ```json 130 { 131 "version": 6, 132 "upload_path": "https://binstore.hashicorp.com/ddbd7db6-f96c-4633-beb6-22fe2d74eeed", 133 "token": "ddbd7db6-f96c-4633-beb6-22fe2d74eeed" 134 } 135 ``` 136 137 - `version` `(int)` - the unique version instance number. This is 138 auto-incrementing. 139 140 - `upload_path` `(string)` - the path where the archive should be uploaded via a 141 `POST` request. 142 143 - `token` `(string)` - the token that should be used when uploading the archive 144 to the `upload_path`. 145 146 ## Check Upload Progress 147 148 This endpoint retrieves the progress for an upload of a configuration version. 149 150 | Method | Path | 151 | :----- | :------------- | 152 | `GET` | `/terraform/configurations/:username/:name/versions/progress/:token` | 153 154 ### Parameters 155 156 - `:username` `(string: <required>)` - Specifies the username or organization to 157 read progress. This is specified as part of the URL. 158 159 - `:name` `(string: <required>)` - Specifies the name of the configuration for 160 to read progress. This is specified as part of the URL. 161 162 - `:token` `(string: <required>)` - Specifies the token that was returned from 163 the create option. **This is not an Atlas Token!** This is specified as part 164 of the URL. 165 166 ### Sample Request 167 168 ```text 169 $ curl \ 170 --header "X-Atlas-Token: ..." \ 171 https://atlas.hashicorp.com/api/v1/terraform/configurations/my-organization/my-configuration/versions/progress/ddbd7db6-f96c-4633-beb6-22fe2d74eeed 172 ``` 173 174 ### Sample Response