terrajet icon indicating copy to clipboard operation
terrajet copied to clipboard

Add example manifest generation pipeline

Open ulucinar opened this issue 2 years ago • 0 comments

Description of your changes

Fixes #48

This PR adds an example manifest generation pipeline. The example manifests are scraped from Terraform registry.

I have:

  • [x] Read and followed Crossplane's contribution process.
  • [x] Run make reviewable to ensure this PR is ready for review.
  • [ ] Added backport release-x.y labels to auto-backport this PR if necessary.

How has this code been tested

Please see examples-generated folders in https://github.com/crossplane-contrib/provider-jet-azure/pull/111, https://github.com/crossplane-contrib/provider-jet-aws/pull/138, and https://github.com/crossplane-contrib/provider-jet-gcp/pull/19 for generated manifests.

An example manifest generated for provider-jet-azure:

# This example manifest is auto-generated, and has not been tested.
# Please make the necessary adjustments before using it.
#apiVersion: devices.azure.jet.crossplane.io/v1alpha2
#kind: IOTHub
#metadata:
#  name: example
#spec:
#  forProvider:
#    endpoint:
#    - batchFrequencyInSeconds: 60
#      connectionStringSecretRef:
#        key: attribute.primary_blob_connection_string
#        name: example-storage-account
#        namespace: crossplane-system
#      containerNameRef:
#        name: example
#      encoding: Avro
#      fileNameFormat: '{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}'
#      maxChunkSizeInBytes: 10485760
#      name: export
#      type: AzureIotHub.StorageContainer
#    - connectionStringSecretRef:
#        key: attribute.primary_connection_string
#        name: example-eventhub-authorization-rule
#        namespace: crossplane-system
#      name: export2
#      type: AzureIotHub.EventHub
#    enrichment:
#    - endpointNames:
#      - export
#      - export2
#      key: tenant
#      value: $twin.tags.Tenant
#    location: West Europe
#    resourceGroupNameRef:
#      name: example
#    route:
#    - condition: "true"
#      enabled: true
#      endpointNames:
#      - export
#      name: export
#      source: DeviceMessages
#    - condition: "true"
#      enabled: true
#      endpointNames:
#      - export2
#      name: export2
#      source: DeviceMessages
#    sku:
#    - capacity: "1"
#      name: S1
#    tags:
#      purpose: testing
#  providerConfigRef:
#    name: example

Corresponding Terraform resource from registry:

resource "azurerm_iothub" "example" {
  name                = "Example-IoTHub"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location

  sku {
    name     = "S1"
    capacity = "1"
  }

  endpoint {
    type                       = "AzureIotHub.StorageContainer"
    connection_string          = azurerm_storage_account.example.primary_blob_connection_string
    name                       = "export"
    batch_frequency_in_seconds = 60
    max_chunk_size_in_bytes    = 10485760
    container_name             = azurerm_storage_container.example.name
    encoding                   = "Avro"
    file_name_format           = "{iothub}/{partition}_{YYYY}_{MM}_{DD}_{HH}_{mm}"
  }

  endpoint {
    type              = "AzureIotHub.EventHub"
    connection_string = azurerm_eventhub_authorization_rule.example.primary_connection_string
    name              = "export2"
  }

  route {
    name           = "export"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["export"]
    enabled        = true
  }

  route {
    name           = "export2"
    source         = "DeviceMessages"
    condition      = "true"
    endpoint_names = ["export2"]
    enabled        = true
  }

  enrichment {
    key            = "tenant"
    value          = "$twin.tags.Tenant"
    endpoint_names = ["export", "export2"]
  }

  tags = {
    purpose = "testing"
  }
}

ulucinar avatar Dec 14 '21 06:12 ulucinar