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

Add Scraped Example Manifests #111

Merged
merged 1 commit into from
Jan 18, 2022

Conversation

ulucinar
Copy link
Collaborator

@ulucinar ulucinar commented Dec 10, 2021

Description of your changes

This PR aims to populate some scraped example resource manifests for the Terraform-based azurerm provider. The context is crossplane/terrajet#48.

I have:

  • Read and followed Crossplane's contribution process.
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

An example manifest generated:

# 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 changed the title Add Terraform provider metadata Add Scraped Example Manifests Dec 10, 2021
@muvaf
Copy link
Member

muvaf commented Dec 13, 2021

How is this file produced?

@ulucinar
Copy link
Collaborator Author

ulucinar commented Jan 3, 2022

Manifest only PRs:
#111
crossplane-contrib/provider-jet-gcp#19
crossplane-contrib/provider-jet-aws#138

How is this file produced?

These example manifests are generated from YAML-formatted metadata, which is in turn scraped from Terraform registry. Will detail the process with a one-pager as it has some further use-cases like doc generation for terrajet-based providers.

@ulucinar ulucinar force-pushed the example-manifests branch 2 times, most recently from c509115 to 7b8fc13 Compare January 12, 2022 02:57
Signed-off-by: Alper Rifat Ulucinar <[email protected]>
Copy link
Collaborator

@sergenyalcin sergenyalcin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you @ulucinar

@ulucinar ulucinar merged commit e04776f into crossplane-contrib:main Jan 18, 2022
@ulucinar ulucinar deleted the example-manifests branch January 18, 2022 12:40
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.

3 participants