Skip to content

Commit

Permalink
Merge pull request #12 from mineiros-io/katcipis-fix-template-spec-is…
Browse files Browse the repository at this point in the history
…-required

fix: template specification is required
  • Loading branch information
katcipis authored Apr 7, 2022
2 parents 244415a + 350c015 commit a872abb
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Fix template variable that is required (was defined as optional)

## [0.0.2]

### Added
Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,11 @@ See [variables.tf] and [examples/] for details and use-cases.
apply the `lifecycle.ignore_changes` rule to the
`metadata.0.annotations` field.

- [**`spec`**](#attr-template-spec): *(Optional `object(spec)`)*<a name="attr-template-spec"></a>
- [**`spec`**](#attr-template-spec): *(**Required** `object(spec)`)*<a name="attr-template-spec"></a>

RevisionSpec holds the desired state of the Revision (from the
client).

Default is `{}`.

The `spec` object accepts the following attributes:

- [**`container_concurrency`**](#attr-template-spec-container_concurrency): *(Optional `number`)*<a name="attr-template-spec-container_concurrency"></a>
Expand Down
4 changes: 2 additions & 2 deletions README.tfdoc.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ section {
}

attribute "spec" {
required = true
type = object(spec)
default = {}
description = <<-END
RevisionSpec holds the desired state of the Revision (from the
client).
Expand Down Expand Up @@ -281,8 +281,8 @@ section {
}

attribute "containers" {
required = true
type = list(container)
default = []
description = <<-END
Container defines the unit of execution for this Revision. In the
context of a Revision, we disallow a number of the fields of this
Expand Down
11 changes: 11 additions & 0 deletions examples/example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ module "terraform-google-cloud-run" {
# All required module arguments
name = "mineiros-cloud-run-example"
location = "europe-north1"
template = {
spec = {
containers = [
{
# Cloud run only accepts images on GCR/Artifact Registry
# So we use a k8s public test image hosted on GCR
image = "gcr.io/kubernetes-e2e-test-images/echoserver:2.2"
}
]
}
}

# All optional module arguments set to the default values

Expand Down
11 changes: 5 additions & 6 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ variable "location" {
type = string
}

variable "template" {
description = "(Required) A template holds the latest specification for the Revision to be stamped out. The template references the container image, and may also include labels and annotations that should be attached to the Revision. To correlate a Revision, and/or to force a Revision to be created when the spec doesn't otherwise change, a nonce label may be provided in the template metadata."
type = any
}

# ---------------------------------------------------------------------------------------------------------------------
# OPTIONAL VARIABLES
# These variables have defaults, but may be overridden.
Expand All @@ -30,12 +35,6 @@ variable "autogenerate_revision_name" {
default = null
}

variable "template" {
description = "(Optional) A template holds the latest specification for the Revision to be stamped out. The template references the container image, and may also include labels and annotations that should be attached to the Revision. To correlate a Revision, and/or to force a Revision to be created when the spec doesn't otherwise change, a nonce label may be provided in the template metadata."
type = any
default = null
}

variable "traffic" {
description = "(Optional) A list of traffic specifies how to distribute traffic over a collection of Knative Revisions and Configurations Structure."
type = any
Expand Down

0 comments on commit a872abb

Please sign in to comment.