From 55f8f185a1f3c91b0e7020cd3df42a1fd1013f02 Mon Sep 17 00:00:00 2001 From: Moritz Sanft <58110325+msanft@users.noreply.github.com> Date: Wed, 13 Dec 2023 10:36:59 +0100 Subject: [PATCH] terraform-provider: update generated documentation --- .../docs/data-sources/attestation.md | 4 +- .../docs/resources/cluster.md | 42 ++++++++++++++----- .../constellation_cluster/resource.tf | 42 ++++++++++++++----- .../provider/attestation_data_source.go | 5 ++- 4 files changed, 69 insertions(+), 24 deletions(-) diff --git a/terraform-provider-constellation/docs/data-sources/attestation.md b/terraform-provider-constellation/docs/data-sources/attestation.md index 40bbeeadb..8a8838c8e 100644 --- a/terraform-provider-constellation/docs/data-sources/attestation.md +++ b/terraform-provider-constellation/docs/data-sources/attestation.md @@ -3,12 +3,12 @@ page_title: "constellation_attestation Data Source - constellation" subcategory: "" description: |- - The data source to fetch measurements from a configured cloud provider and image. + Data source to fetch an attestation configuration for a given cloud service provider, attestation variant, and OS image. --- # constellation_attestation (Data Source) -The data source to fetch measurements from a configured cloud provider and image. +Data source to fetch an attestation configuration for a given cloud service provider, attestation variant, and OS image. ## Example Usage diff --git a/terraform-provider-constellation/docs/resources/cluster.md b/terraform-provider-constellation/docs/resources/cluster.md index 88190f556..c8a063817 100644 --- a/terraform-provider-constellation/docs/resources/cluster.md +++ b/terraform-provider-constellation/docs/resources/cluster.md @@ -13,23 +13,45 @@ Resource for a Constellation cluster. ## Example Usage ```terraform -// Not up-to-date - data "constellation_attestation" "foo" {} # Fill accordingly for the CSP and attestation variant data "constellation_image" "bar" {} # Fill accordingly for the CSP -resource "constellation_cluster" "aws_example" { - csp = "aws" +resource "random_bytes" "master_secret" { + length = 32 +} + +resource "random_bytes" "master_secret_salt" { + length = 32 +} + +resource "random_bytes" "measurement_salt" { + length = 32 +} + +resource "constellation_cluster" "azure_example" { + csp = "azure" + constellation_microservice_version = "vX.Y.Z" name = "constell" - uid = "deadbeef" - constellation_microservice_version = "vx.y.z" - image = data.constellation_image.bar.image + uid = "..." + image_version = "vX.Y.Z" + image_reference = data.constellation_image.bar.reference attestation = data.constellation_attestation.foo.attestation - init_secret = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - master_secret = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - master_secret_salt = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" + init_secret = "..." + master_secret = random_bytes.master_secret.hex + master_secret_salt = random_bytes.master_secret_salt.hex + measurement_salt = random_bytes.measurement_salt.hex out_of_cluster_endpoint = "123.123.123.123" + azure = { + tenant_id = "..." + subscription_id = "..." + uami_client_id = "..." + uami_resource_id = "..." + location = "..." + resource_group = "..." + load_balancer_name = "..." + network_security_group_name = "..." + } network_config = { ip_cidr_node = "192.168.176.0/20" ip_cidr_service = "10.96.0.0/12" diff --git a/terraform-provider-constellation/examples/resources/constellation_cluster/resource.tf b/terraform-provider-constellation/examples/resources/constellation_cluster/resource.tf index 35d9029e0..52a77e989 100644 --- a/terraform-provider-constellation/examples/resources/constellation_cluster/resource.tf +++ b/terraform-provider-constellation/examples/resources/constellation_cluster/resource.tf @@ -1,20 +1,42 @@ -// Not up-to-date - data "constellation_attestation" "foo" {} # Fill accordingly for the CSP and attestation variant data "constellation_image" "bar" {} # Fill accordingly for the CSP -resource "constellation_cluster" "aws_example" { - csp = "aws" +resource "random_bytes" "master_secret" { + length = 32 +} + +resource "random_bytes" "master_secret_salt" { + length = 32 +} + +resource "random_bytes" "measurement_salt" { + length = 32 +} + +resource "constellation_cluster" "azure_example" { + csp = "azure" + constellation_microservice_version = "vX.Y.Z" name = "constell" - uid = "deadbeef" - constellation_microservice_version = "vx.y.z" - image = data.constellation_image.bar.image + uid = "..." + image_version = "vX.Y.Z" + image_reference = data.constellation_image.bar.reference attestation = data.constellation_attestation.foo.attestation - init_secret = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - master_secret = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" - master_secret_salt = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef" + init_secret = "..." + master_secret = random_bytes.master_secret.hex + master_secret_salt = random_bytes.master_secret_salt.hex + measurement_salt = random_bytes.measurement_salt.hex out_of_cluster_endpoint = "123.123.123.123" + azure = { + tenant_id = "..." + subscription_id = "..." + uami_client_id = "..." + uami_resource_id = "..." + location = "..." + resource_group = "..." + load_balancer_name = "..." + network_security_group_name = "..." + } network_config = { ip_cidr_node = "192.168.176.0/20" ip_cidr_service = "10.96.0.0/12" diff --git a/terraform-provider-constellation/internal/provider/attestation_data_source.go b/terraform-provider-constellation/internal/provider/attestation_data_source.go index 8d8e07646..47322df47 100644 --- a/terraform-provider-constellation/internal/provider/attestation_data_source.go +++ b/terraform-provider-constellation/internal/provider/attestation_data_source.go @@ -85,8 +85,9 @@ func (d *AttestationDataSource) Metadata(_ context.Context, req datasource.Metad // Schema returns the schema for the data source. func (d *AttestationDataSource) Schema(_ context.Context, _ datasource.SchemaRequest, resp *datasource.SchemaResponse) { resp.Schema = schema.Schema{ - // This description is used by the documentation generator and the language server. - MarkdownDescription: "The data source to fetch measurements from a configured cloud provider and image.", + Description: "Data source to fetch an attestation configuration for a given cloud service provider, attestation variant, and OS image.", + MarkdownDescription: "Data source to fetch an attestation configuration for a given cloud service provider, attestation variant, and OS image.", + Attributes: map[string]schema.Attribute{ "csp": newCSPAttribute(), "attestation_variant": newAttestationVariantAttribute(attributeInput),