Skip to content

Commit

Permalink
add request and response headers for module paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rumenvasilev committed Oct 25, 2023
1 parent 0630d48 commit 7bcaec8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Latest

* Registry response to module version download path must be 204, not 200, because the server returns empty body. Download link is passed by means of X-Terraform-Get response header. Both terraform and opentofu support that (in fact they do support both 200 and 204). None of the production registries use 204 at the moment.
* Added X-Terraform-Version request header for module calls
* Registry response to module version download path must be 204, not 200, because the server returns empty body. Download link is passed by means of X-Terraform-Get response header. Both terraform and opentofu support that (in fact they do support both 200 and 204).
* Added response errors to the model.
* Updated the regex for module download URL
* Added release github action, publishing the resulting openapi specification.
Expand Down
7 changes: 7 additions & 0 deletions model/module.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace tf.registry.module
use tf.registry.errors#NotFound
use tf.registry.shapes#NamespaceDef
use tf.registry.shapes#SemVer
use tf.registry.shapes#TFVersion
use tf.registry.shapes#githubModuleDownloadURL

resource Module {
Expand All @@ -26,6 +27,9 @@ operation GetModuleVersion {

@input
structure GetModuleVersionInput {
@httpHeader("X-Terraform-Version")
xterraformversion: TFVersion

@required
@httpLabel
namespace: NamespaceDef = "terraform-aws-modules"
Expand Down Expand Up @@ -63,6 +67,9 @@ operation ListModuleVersions {

@input
structure ListModuleVersionsInput {
@httpHeader("X-Terraform-Version")
xterraformversion: TFVersion

@required
@httpLabel
namespace: NamespaceDef = "terraform-aws-modules"
Expand Down
7 changes: 7 additions & 0 deletions model/shapes.smithy
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,10 @@ string NamespaceDef
// semver
@pattern("^(([0-9]{1}|[1-9][0-9])\\.){2}([0-9]{1}|[1-9][0-9]{1,2})$")
string SemVer

// terraform version
// semver | semver-beta
@pattern(
"^((([0-9]{1}|[1-9][0-9])\\.){2}([0-9]{1}|[1-9][0-9]{1,2}))$|(([0-9]{1}|[1-9][0-9])\\.){2}([0-9]{1}|[1-9][0-9]{1,2})-\\w+$"
)
string TFVersion

0 comments on commit 7bcaec8

Please sign in to comment.