Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Add example manifest generation pipeline #173

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented Dec 14, 2021

Description of your changes

Fixes #48

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

I have:

  • Read and followed Crossplane's contribution process.
  • 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 crossplane-contrib/provider-jet-azure#111, crossplane-contrib/provider-jet-aws#138, and crossplane-contrib/provider-jet-gcp#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 ulucinar force-pushed the fix-48 branch 4 times, most recently from 90b9634 to f444f6e Compare December 14, 2021 07:19
@ulucinar ulucinar force-pushed the fix-48 branch 4 times, most recently from 6a039a9 to bf4c470 Compare January 6, 2022 16:11
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate example YAMLs
1 participant