Skip to content

Commit

Permalink
feat: Add an output value denoting the type of the blueprint (#184)
Browse files Browse the repository at this point in the history
* Update outputs.tf

* Remove version from blueprint type.

* Fix lint.

* Add version suffix to blueprint type and regen docs.

* Add tests.

* Move blueprint type value to local in versions.tf
  • Loading branch information
ankurdua authored Nov 19, 2021
1 parent a5d25c6 commit e5fec3e
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ module "secured_data_warehouse" {

| Name | Description |
|------|-------------|
| blueprint\_type | Type of blueprint this module represents. |
| cmek\_bigquery\_crypto\_key | The Customer Managed Crypto Key for the BigQuery service. |
| cmek\_confidential\_bigquery\_crypto\_key | The Customer Managed Crypto Key for the confidential BigQuery service. |
| cmek\_data\_ingestion\_crypto\_key | The Customer Managed Crypto Key for the data ingestion crypto boundary. |
Expand Down
1 change: 1 addition & 0 deletions examples/simple-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ This example illustrates how to use the `secured-data-warehouse` module.

| Name | Description |
|------|-------------|
| blueprint\_type | Type of blueprint this module represents. |
| cmek\_bigquery\_crypto\_key | The Customer Managed Crypto Key for the BigQuery service. |
| cmek\_confidential\_bigquery\_crypto\_key | The Customer Managed Crypto Key for the confidential BigQuery service. |
| cmek\_data\_ingestion\_crypto\_key | The Customer Managed Crypto Key for the data ingestion crypto boundary. |
Expand Down
5 changes: 5 additions & 0 deletions examples/simple-example/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ output "cmek_confidential_bigquery_crypto_key" {
description = "The Customer Managed Crypto Key for the confidential BigQuery service."
value = module.secured_data_warehouse.cmek_confidential_bigquery_crypto_key
}

output "blueprint_type" {
description = "Type of blueprint this module represents."
value = module.secured_data_warehouse.blueprint_type
}
5 changes: 5 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,8 @@ output "cmek_confidential_bigquery_crypto_key" {
time_sleep.wait_for_bridge_propagation
]
}

output "blueprint_type" {
description = "Type of blueprint this module represents."
value = local.blueprint_type
}
5 changes: 5 additions & 0 deletions test/fixtures/simple-example/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,8 @@ output "cmek_confidential_bigquery_crypto_key" {
description = "The Customer Managed Crypto Key for the confidential BigQuery service."
value = module.simple_example.cmek_confidential_bigquery_crypto_key
}

output "blueprint_type" {
description = "Type of blueprint this module represents."
value = module.simple_example.blueprint_type
}
9 changes: 8 additions & 1 deletion test/integration/simple-example/controls/gcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

project_id = attribute('project_id')
blueprint_type = attribute('blueprint_type')

boolean_policy_constraints = [
'constraints/iam.disableServiceAccountCreation',
Expand All @@ -27,7 +28,7 @@
]

control 'gcloud' do
title 'organization boolean and list policy tests'
title 'boolean and list organization policy and output tests'

boolean_policy_constraints.each do |constraint|
describe command("gcloud beta resource-manager org-policies list --project=#{project_id} --format=json") do
Expand Down Expand Up @@ -82,4 +83,10 @@
end
end
end

describe "check blueprint_type #{blueprint_type}" do
it 'should have expected value' do
expect("#{blueprint_type}" ).to eq 'blueprints/terraform/terraform-google-secured-data-warehouse/v1.0.0'
end
end
end
3 changes: 3 additions & 0 deletions test/integration/simple-example/inspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,6 @@ attributes:
- name: cmek_confidential_bigquery_crypto_key
required: true
type: string
- name: blueprint_type
required: true
type: string
4 changes: 4 additions & 0 deletions versions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ terraform {
}

}

locals {
blueprint_type = "blueprints/terraform/terraform-google-secured-data-warehouse/v1.0.0"
}

0 comments on commit e5fec3e

Please sign in to comment.