Giter VIP home page Giter VIP logo

terraform-provider-pulsar's Introduction

Terraform Provider for Pulsar

Authored by [StreamNative], this repository includes the source code and documentation for a Terraform provider for managing Apache Pulsar entities such as clusters, tenants, namespaces, topics, sources, and sinks.

Prerequisites

  • Terraform 0.12.0 or later
  • Go 1.16 or later (to build the provider plugin)

Installation

  • From terraform registry

    This provider has been published in the Terraform Registry:

    terraform {
      required_providers {
        pulsar = {
          version = "0.1.3"
          source = "registry.terraform.io/streamnative/pulsar"
        }
      }
    }
  • From source code

    • Clone this repository and cd into the directory
    • Run make build, it will generate a binary file named terraform-provider-pulsar
    • Copy this terraform-provider-pulsar binary file to your terraform plugin directory based on your OS:
Operating System User plugins directory
Windows(amd64) %APPDATA%\terraform.d\plugins\registry.terraform.io\streamnative\pulsar\0.1.0\windows_amd64\
Linux(amd64) ~/.terraform.d/plugins/registry.terraform.io/streamnative/pulsar/0.1.0/linux_amd64/
MacOS(amd64) ~/.terraform.d/plugins/registry.terraform.io/streamnative/pulsar/0.1.0/darwin_amd64/
  • Run make build-dev, it will build the binary and copy it to the plugin directory automatically.

Version Compatibility

The compatibility matrix from terraform-provider-pulsar to pulsar as shown below:

Min Version of Pulsar
v0.2.x pulsar 2.10.4
v0.1.x pulsar 2.8.x

Note: It's not strictly tested. Please report issues when you encounter any bugs.

Using the Provider

Configurations

Example

Example provider with apache pulsar cluster, running locally with authentication disabled.

provider "pulsar" {
  web_service_url = "http://localhost:8080"
  token           = "my_auth_token"
}
provider "pulsar" {
  web_service_url           = "https://localhost:8443"
  tls_trust_certs_file_path = "./ca.pem"
  tls_key_file_path         = "./key.pem"
  tls_cert_file_path        = "./cert.pem"
}

Properties

Property Description Required
web_service_url URL of your Apache Pulsar Cluster Yes
token Authentication Token for your Apache Pulsar Cluster, which is required only if your cluster has authentication enabled No
tls_trust_certs_file_path Path to a custom trusted TLS certificate file No
tls_key_file_path Path to the key to use when using TLS client authentication No
tls_cert_file_path Path to the cert to use when using TLS client authentication No
tls_allow_insecure_connection Boolean flag to accept untrusted TLS certificates No
api_version Used to request Apache Pulsar API service, default by 0, which represents use default version No
audience The OAuth 2.0 resource server identifier for the Pulsar cluster No
client_id The OAuth 2.0 client identifier No
issuer_url The OAuth 2.0 URL of the authentication provider which allows the Pulsar client to obtain an access token No
scope The OAuth 2.0 scope to request No
key_file_path The path of the private key file No

Resources

pulsar_cluster

A resource for managing Apache Pulsar Clusters, can update various properties for a given cluster.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
}

resource "pulsar_cluster" "my_cluster" {
  cluster = "eternals"

  cluster_data {
    web_service_url    = "http://localhost:8080"
    broker_service_url = "http://localhost:6050"
    peer_clusters      = ["skrulls", "krees"]
  }
}

Properties

Property Description Required
cluster Name of the Cluster that you want to create Yes
cluster_data A Map of required fields for the cluster Yes
web_service_url Required in cluster data, pointing to your broker web service Yes
web_service_url_tls Pointing to your broker web service via tls No
broker_service_url Required in cluster data for broker discovery Yes
broker_service_url_tls Required in cluster data for broker discovery via tls No
peer_clusters Required in cluster data for adding peer clusters Yes

pulsar_tenant

A resource for managing Pulsar Tenants, can update admin roles and allowed clusters for a tenant.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
}

resource "pulsar_tenant" "my_tenant" {
  tenant           = "thanos"
  allowed_clusters = ["pulsar-cluster-1"]
  admin_roles      = ["godmode"]
}

Properties

Property Description Required
tenant Name of the Tenant that you want to create Yes
allowed_clusters An Array of clusters, accessible by this tenant No
admin_roles Admin Roles to be assumed by this Tenant No

pulsar_namespace

A resource for creating and managing Apache Pulsar Namespaces, can update various properties for a given namespace.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
}

resource "pulsar_cluster" "test_cluster" {
  cluster = "skrulls"

  cluster_data {
    web_service_url    = "http://localhost:8080"
    broker_service_url = "http://localhost:6050"
    peer_clusters      = ["standalone"]
  }
}

resource "pulsar_tenant" "test_tenant" {
  tenant           = "thanos"
  allowed_clusters = [pulsar_cluster.test_cluster.cluster, "standalone"]
}

resource "pulsar_namespace" "test" {
  tenant    = pulsar_tenant.test_tenant.tenant
  namespace = "eternals"

  enable_deduplication = true

  // If defined partially, plan would show difference
  // however, none of the mising optionals would be changed
  namespace_config {
    anti_affinity                  = "anti-aff"
    max_consumers_per_subscription = "50"
    max_consumers_per_topic        = "50"
    max_producers_per_topic        = "50"
    message_ttl_seconds            = "86400"
    replication_clusters           = ["standalone"]
  }

  dispatch_rate {
    dispatch_msg_throttling_rate  = 50
    rate_period_seconds           = 50
    dispatch_byte_throttling_rate = 2048
  }

  subscription_dispatch_rate {
    dispatch_msg_throttling_rate  = 50
    rate_period_seconds           = 50
    dispatch_byte_throttling_rate = 2048
  }

  retention_policies {
    retention_minutes    = "1600"
    retention_size_in_mb = "10000"
  }

  backlog_quota {
    limit_bytes  = "10000000000"
    limit_seconds = "-1"
    policy = "consumer_backlog_eviction"
    type = "destination_storage"
  }

  persistence_policies {
    bookkeeper_ensemble                   = 1   // Number of bookies to use for a topic, default: 0
    bookkeeper_write_quorum               = 1   // How many writes to make of each entry, default: 0
    bookkeeper_ack_quorum                 = 1   // Number of acks (guaranteed copies) to wait for each entry, default: 0
    managed_ledger_max_mark_delete_rate   = 0.0 // Throttling rate of mark-delete operation (0 means no throttle), default: 0.0
  }

  permission_grant {
    role    = "some-role"
    actions = ["produce", "consume", "functions"]
  }
}

Properties

Property Description Required
tenant Name of the Tenant managing this namespace Yes
namespace name of the namespace Yes
enable_deduplication Message deduplication state on a namespace No
namespace_config Configuration for your namespaces like max allowed producers to produce messages No
dispatch_rate Apache Pulsar throttling config for topics No
subscription_dispatch_rate Apache Pulsar throttling config for subscriptions No
retention_policies Data retention policies No
backlog_quota Backlog Quota for all topics No
persistence_policies Persistence policies for all topics under a given namespace No
permission_grant Permission grants on a namespace. This block can be repeated for each grant you'd like to add No

namespace_config nested schema

Property Description Required
anti_affinity Anti-affinity group name No
is_allow_auto_update_schema Is schema auto-update allowed No
max_consumers_per_subscription Sets the max consumers per subscription No
max_consumers_per_topic Sets the max consumers per topic No
max_producers_per_topic Sets the max producers per topic No
message_ttl_seconds Sets the message TTL in seconds No
replication_clusters List of replication clusters for the namespace No
schema_compatibility_strategy Set schema compatibility strategy No
schema_validation_enforce Enable or disable schema validation No

The schema_compatibility_strategy can take the following values:

  • AutoUpdateDisabled
  • Backward
  • Forward
  • Full
  • AlwaysCompatible
  • BackwardTransitive
  • ForwardTransitive
  • FullTransitive

pulsar_topic

A resource for creating and managing Apache Pulsar Topics, can update partitions for a given partition topic.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
}

resource "pulsar_topic" "sample-topic-1" {
  tenant     = "public"
  namespace  = "default"
  topic_type = "persistent"
  topic_name = "partition-topic"
  partitions = 4                     # partitions > 0 means this is a partition topic

  permission_grant {
    role    = "some-role"
    actions = ["produce", "consume", "functions"]
  }

  retention_policies {
    retention_time_minutes = 1600
    retention_size_mb = 20000
  }
}

resource "pulsar_topic" "sample-topic-2" {
  tenant     = "public"
  namespace  = "default"
  topic_type = "persistent"
  topic_name = "non-partition-topic"
  partitions = 0                     # partitions = 0 means this is a non-partition topic

  permission_grant {
    role    = "some-role"
    actions = ["produce", "consume", "functions"]
  }

  retention_policies {
    retention_time_minutes = 1600
    retention_size_mb = 20000
  }
}

Properties

Property Description Required
tenant Name of the Tenant managing this topic Yes
namespace Name of the Namespace for this topic Yes
topic_type Topic persistence (persistent, non-persistent) Yes
topic_name Name of the topic Yes
partitions Number of partitions (0 for non-partitioned topic, > 1 for partitioned topic) Yes
permission_grant Permission grants on a topic. This block can be repeated for each grant you'd like to add. Permission grants are also inherited from the topic's namespace. No
retention_policies Data retention policies No

pulsar_function

A resource for creating and managing Apache Pulsar Functions.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
  api_version = "3"
}

resource "pulsar_function" "function-1" {
  provider = pulsar

  name = "function1"
  tenant = "public"
  namespace = "default"
  parallelism = 1

  processing_guarantees = "ATLEAST_ONCE"

  jar = "/Downloads/apache-pulsar-2.10.1/examples/api-examples.jar"
  classname = "org.apache.pulsar.functions.api.examples.WordCountFunction"

  inputs = ["public/default/input1", "public/default/input2"]

  output = "public/default/test-out"

  subscription_name = "test-sub"
  subscription_position = "Latest"
  cleanup_subscription = true
  skip_to_latest = true
  forward_source_message_property = true
  retain_key_ordering = true
  auto_ack = true
  max_message_retries = 101
  dead_letter_topic = "public/default/dlt"
  log_topic = "public/default/lt"
  timeout_ms = 6666

  secrets = jsonencode(
  {
    "SECRET1": {
       "path": "sectest"
       "key": "hello"
    }
  })
  custom_runtime_options = jsonencode(
  {
      "env": {
          "MILLBRAE": "HILLCREST"
      }
  })
}

Properties

Property Description Required
name The name of the function. True
tenant The tenant of the function. True
namespace The namespace of the function. True
jar The path to the jar file. False
py The path to the python file. False
go The path to the go file. False
classname The class name of the function. False
inputs The input topics of the function. False
topics_pattern The input topics pattern of the function. The pattern is a regex expression. The function consumes from all topics matching the pattern. False
output The output topic of the function. False
parallelism The parallelism of the function. False
processing_guarantees The processing guarantees (aka delivery semantics) applied to the function. Possible values are ATMOST_ONCE, ATLEAST_ONCE, and EFFECTIVELY_ONCE. False
subscription_name The subscription name of the function. False
subscription_position The subscription position of the function. Possible values are LATEST, EARLIEST, and CUSTOM. False
cleanup_subscription Whether to clean up subscription when the function is deleted. False
skip_to_latest Whether to skip to the latest position when the function is restarted after failure. False
forward_source_message_property Whether to forward source message property to the function output message. False
retain_ordering Whether to retain ordering when the function is restarted after failure. False
retain_key_ordering Whether to retain key ordering when the function is restarted after failure. False
auto_ack User defined configs key/values (JSON string) False
max_message_retries The maximum number of times that a message will be retried when the function is configured with EFFECTIVELY_ONCE processing guarantees. False
dead_letter_topic The dead letter topic of the function. False
log_topic The log topic of the function. False
timeout_ms The timeout of the function in milliseconds. False
input_type_classname The input type class name of the function. False
output_type_classname The output type class name of the function. False
output_serde_classname The output serde class name of the function. False
output_schema_type The output schema type of the function. False
custom_serde_inputs The custom serde inputs of the function. False
custom_schema_inputs The custom schema inputs of the function. False
custom_schema_outputs The custom schema outputs of the function. False
custom_runtime_options The custom runtime options of the function. False
secrets The secrets of the function. False
cpu The CPU that needs to be allocated per function instance False
ram_mb The RAM that need to be allocated per function instance False
disk_mb The disk that need to be allocated per function instance False

pulsar_source

A resource for creating and managing Apache Pulsar Sources.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
  api_version = "3"
}

resource "pulsar_source" "source-1" {
  provider = pulsar

  name = "source-1"
  tenant = "public"
  namespace = "default"

  archive = "testdata/pulsar-io/pulsar-io-file-2.10.4.nar"

  destination_topic_name = "source-1-topic"

  processing_guarantees = "EFFECTIVELY_ONCE"

  configs = "{\"inputDirectory\":\"opt\"}"

  cpu = 2
  disk_mb = 20480
  ram_mb = 2048
}

Properties

Property Description Required
name The source's name True
tenant The source's tenant True
namespace The source's namespace True
destination_topic_name The Pulsar topic to which data is sent True
archive The path to the NAR archive for the Source. It also supports url-path [http/https/file (file protocol assumes that file already exists on worker host)] from which worker can download the package True
classname The source's class name if archive is file-url-path (file://) False
configs User defined configs key/values (JSON string) False
deserialization_classname The SerDe classname for the source False
processing_guarantees Define the message delivery semantics, default to ATLEAST_ONCE (ATLEAST_ONCE, ATMOST_ONCE, EFFECTIVELY_ONCE) False
parallelism The source's parallelism factor False
cpu The CPU that needs to be allocated per source instance (applicable only to Docker runtime) False
ram_mb The RAM that need to be allocated per source instance (applicable only to the process and Docker runtimes) False
disk_mb The disk that need to be allocated per source instance (applicable only to Docker runtime) False
runtime_flags User defined configs key/values (JSON string) False

pulsar_sink

A resource for creating and managing Apache Pulsar Sinks.

Example

provider "pulsar" {
  web_service_url = "http://localhost:8080"
  api_version = "3"
}

resource "pulsar_sink" "sample-sink-1" {
  provider = pulsar

  name = "sample-sink-1"
  tenant = "public"
  namespace = "default"
  inputs = ["sink-1-topic"]
  subscription_position = "Latest"
  cleanup_subscription = false
  parallelism = 1
  auto_ack = true

  processing_guarantees = "EFFECTIVELY_ONCE"

  archive = "testdata/pulsar-io/pulsar-io-jdbc-postgres-2.10.4.nar"
  configs = "{\"jdbcUrl\":\"jdbc:clickhouse://localhost:8123/pulsar_clickhouse_jdbc_sink\",\"password\":\"password\",\"tableName\":\"pulsar_clickhouse_jdbc_sink\",\"userName\":\"clickhouse\"}"
}

Properties

Property Description Required
tenant The sink's tenant True
namespace The sink's namespace True
name The sink's name True
inputs The sink's input topics False
topics_pattern TopicsPattern to consume from list of topics under a namespace that match the pattern False
input_specs The map of input topics specs False
configs User defined configs key/values (JSON string) False
archive Path to the archive file for the sink. It also supports url-path [http/https/file (file protocol assumes that file already exists on worker host)] from which worker can download the package True
subscription_name Pulsar source subscription name if user wants a specific subscription-name for input-topic consumer False
subscription_position Pulsar source subscription position if user wants to consume messages from the specified location (Latest, Earliest) False
cleanup_subscription Whether the subscriptions the functions created/used should be deleted when the functions was deleted True
processing_guarantees Define the message delivery semantics, default to ATLEAST_ONCE (ATLEAST_ONCE, ATMOST_ONCE, EFFECTIVELY_ONCE) False
retain_ordering Sink consumes and sinks messages in order False
auto_ack Whether or not the framework will automatically acknowledge messages True
timeout_ms The message timeout in milliseconds False
parallelism The sink's parallelism factor False
cpu The CPU that needs to be allocated per sink instance (applicable only to Docker runtime) False
ram_mb The RAM that need to be allocated per sink instance (applicable only to the process and Docker runtimes) False
disk_mb The disk that need to be allocated per sink instance (applicable only to Docker runtime) False
custom_schema_inputs The map of input topics to Schema types or class names (as a JSON string) False
custom_serde_inputs The map of input topics to SerDe class names (as a JSON string) False
custom_runtime_options A string that encodes options to customize the runtime False

Importing existing resources

All resources could be imported using the standard terraform way.

Example

terraform import pulsar_cluster.standalone standalone

Testing the Provider

  • Change directory to the project </path/to/provider/terraform-provider-pulsar>
  • In order to test the provider, you can run make test
  • In order to run the full suite of Acceptance tests, run make testacc

Note: Acceptance tests create real resources, and often cost money to run.

Contributing

Contributions are warmly welcomed and greatly appreciated! Please read the contribution guidelines for more details.

Issues on GitHub are intended to be related to bugs or feature requests with the provider codebase. For a list of community resources to ask questions about Terraform, see https://www.terraform.io/docs/extend/community/index.html.

Licence

This library is licensed under the terms of the Apache License 2.0 and may include packages written by third parties which carry their own copyright notices and license terms.

About StreamNative

Founded in 2019 by the original creators of Apache Pulsar, StreamNative is one of the leading contributors to the open-source Apache Pulsar project. We have helped engineering teams worldwide make the move to Pulsar with StreamNative Cloud, a fully managed service to help teams accelerate time-to-production.

terraform-provider-pulsar's People

Contributors

dependabot[bot] avatar efcasado avatar ericsyh avatar esenac avatar freeznet avatar fushuwang avatar geomagilles avatar jay-dee7 avatar jiangpengcheng avatar jung-kim avatar lanwen avatar lovrogalesic-toast avatar maintux avatar maxsxu avatar miecio45 avatar nlu90 avatar nodece avatar odbaeu avatar oliverisaac avatar sijie avatar simoneau avatar smazurov avatar tisonkun avatar volgorean avatar wangjia007bond avatar yaalsn avatar ypt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

terraform-provider-pulsar's Issues

tests using localhost, when WEB_SERVICE_URL is set

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.12.20

Terraform Configuration Files

The tf configuration run during tests

Debug Output

https://gist.github.com/mdjasper/cd9de1c24132827cacb8498fc4a81f3f

Panic Output

Expected Behavior

I see that in initTestWebServiceURL the tests are looking for the env var WEB_SERVICE_URL. However, even when that is set, the tests are still trying to use the localhost default (see gist)
When make testacc

Actual Behavior

Tests tried to connect to default localhost WEB_SERVICE_URL

Steps to Reproduce

  • cloned repo
  • go installed dependencies
  • local pulsar running in docker using docker-compose and dinghy
  • run make testacc

Ordering is important when updating backlog_quota.limit_bytes and retention_policies.retention_size_in_mb

When a TF file is updated and the update contains changes in a namespace for both backlog_quota.limit_bytes and retention_policies.retention_size_in_mb, the order in which they are updated matters. If the order is incorrect, the update will result in an error. Running the same terraform apply again, results in an OK however.

Pulsar returns an error when you try to configure an backlog quota which exceeds the retention quota(or a retention quota which is lower to the backlog quota):

โ”‚ Error: ERROR_UPDATE_NAMESPACE_CONFIG: 1 error occurred:
โ”‚ * SetRetention: code: 412 reason: Retention Quota must exceed configured backlog quota for namespace.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.2.2
on linux_amd64

Affected Resource(s)

  • resource_pulsar_namespace.go

Terraform Configuration Files

Configuration file can be copied from example: examples/namespaces/maint.tf (https://github.com/streamnative/terraform-provider-pulsar/blob/master/examples/namespaces/main.tf)

Debug Output

not relevant

Panic Output

not relevant

Expected Behavior

Update both retention quota and backlog quota without error.

Actual Behavior

Error is shown:

โ”‚ Error: ERROR_UPDATE_NAMESPACE_CONFIG: 1 error occurred:
โ”‚ * SetRetention: code: 412 reason: Retention Quota must exceed configured backlog quota for namespace.

Steps to Reproduce

  1. terraform apply
  2. update the retention quota to exceed the old retention quota and increase the backlog quota to be just below the new retention quota, but above the old retention quota.
  3. terraform apply

Important Factoids

I think somewhere around this line:

if retentionPoliciesConfig.Len() > 0 {
there needs to be a condition:

  • if both retention and backlog limits are updated
    • if retention limit has decreased
      • backlog needs to be updated first!
    • else
      • retention needs to be updated first!
  • else
    • no change compared to current implementation.

References

  • #0000

Schema functionality missing

Currently we can set the schema compatibility strategy as well as allow auto update schema doing the following using the pulsar-admin tool

./pulsar-admin namespaces set-schema-compatibility-strategy -c FORWARD_TRANSITIVE public/default
./pulsar-admin namespaces set-is-allow-auto-update-schema --disable public/default

Seems like the set-is-allow-auto-update-schema is missing from the terraform modules at the moment, so we need to support this as well.

Error When Updating Sinks - Retain Ordering

When using the Terraform provider to manage sinks, the retain ordering key is not being properly passed from Terraform to the API, causing a 400 error that "Retain ordering cannot be altered" even if it's going false -> false.

The sink is initially created with retain_ordering = false. This works fine. When the TF is run again - even if there is no change to the sink itself, it causes a 400 error.

Community Note

  • Please vote on this issue by adding a
    ๐Ÿ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

terraform 1.5.7

Affected Resource(s)

  • pulsar_sink

Terraform Configuration Files

resource "pulsar_sink" "sink" {
  name                  = "testsink"
  tenant                = "sn"
  namespace             = "system"
  subscription_position = "EARLIEST"
  subscription_name     = "testsink"
  cleanup_subscription  = true
  parallelism           = 1
  auto_ack              = true
  archive               = builtin://cloud-storage
  retain_ordering       = false
  processing_guarantees = "ATLEAST_ONCE"
  cpu                   = 1
  ram_mb                = 1024

  configs = jsonencode({
    role            = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/${var.role_name}"
    roleSessionName = "name"
    provider        = "s3v2"
    bucket          = var.bucket_name
    region          = var.region == "" ? data.aws_region.current.name : var.region
    formatType      = "json"
    pathPrefix      = var.path_prefix
    partitionerType = "TIME"
    awsCannedAcl    = "bucket-owner-full-control"
    withMetadata    = false
  })

  dynamic "input_specs" {
    content {
      key                 = "persistent://sn/system/topic1"
      is_regex_pattern    = false
      receiver_queue_size = 10
      schema_type         = ""
      serde_class_name    = ""
    }
  }
}

Expected Behavior

Ideally TF should realize there are no updates, but at minimum it should properly re-use the sink ordering so the error doesn't occur

Actual Behavior

โ”‚ Error: code: 400 reason: Retain Ordering cannot be altered
โ”‚ 
โ”‚   with module.pulsar_audit_log_sink_workflows.pulsar_sink.sink,
โ”‚   on .terraform/modules/pulsar_audit_log_sink_workflows/pulsar_cloud_storage_sink/sink.tf line 1, in resource "pulsar_sink" "sink":
โ”‚    1: resource "pulsar_sink" "sink" {
โ”‚ 
โ•ต
Operation failed: failed running terraform apply (exit 1)

Steps to Reproduce

  1. Create sink with retain ordering set to false
  2. terraform apply - will work
  3. Run terraform apply again - will fail with 400 error that retain ordering cannot be updated even if it wasnt changed

Function support provide user_config

Community Note

  • Please vote on this issue by adding a
    ๐Ÿ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

New or Affected Resource(s)

  • pulsar_XXXXX

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
resource "pulsar_function" "nlu_wc_tf_test" {
  provider = pulsar
  ...
  user_config = {
    "authToken": "s.SZnq....",
    "middlemileApikey": "dfdfdfd...."
  }
  ....
}

References

  • #0000

Add messageTTL setting to namespace config options

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

This change adds the message_ttl_seconds option to the namespace config provider options. This option sets the messageTTL setting in the namespace

https://pulsar.apache.org/docs/admin-api-namespaces/#configure-message-ttl

New or Affected Resource(s)

  • pulsar_namespace - adds new namespace_config property

Potential Terraform Configuration

resource "pulsar_namespace" "test" {
  tenant    = pulsar_tenant.test_tenant.tenant
  namespace = "eternals"

  namespace_config {
    anti_affinity                  = "anti-aff"
    max_consumers_per_subscription = "50"
    max_consumers_per_topic        = "50"
    max_producers_per_topic        = "50"
    message_ttl_seconds            = "86400"
    replication_clusters           = ["standalone"]
  }
}

References

Support resource imports

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Currently there is no simple way of bringing existing resources under the terraform management, as the provider doesn't support importing.

New or Affected Resource(s)

  • pulsar_* (all of them)

Potential Terraform Configuration

References

Example code https://github.com/terraform-providers/terraform-provider-aws/blob/03b75bedf7daaf08642ba806d761a4b7a835db26/aws/resource_aws_cloudwatch_log_destination_policy.go#L19

https://www.terraform.io/docs/commands/import.html
https://www.terraform.io/docs/import/index.html

During implementation of the drift detection, I found that it could be relatively easy to implement, same way as read

Also in most of the creation cases provider could gracefully handle already existing case and assume the creation option as noop

I can implement importers, as we need that for our current infrastructure

Terraform doesn't support creation of pulsar functions

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

New or Affected Resource(s)

  • pulsar_XXXXX

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

  • #0000

Add to Terraform Registry

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

It would be great if we could install this provider from Terraform Provider registry.

References

https://github.com/hashicorp/terraform/tree/guide-v0.13-beta/provider-sources

Allow Setting `AutoTopicCreation` on Pulsar Namespace Resources

Community Note

  • Please vote on this issue by adding a
    ๐Ÿ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

It would be nice to be able to set/override/remove auto topic creation through the namespace policies when adding a namespace resource via TF. We set this at the broker level but there are some namespace we don't want it on.

New or Affected Resource(s)

  • pulsar_namespace

Potential Terraform Configuration

I think the clearest way to do this is as a separate object within the resource like the retention and persistent policy blocks. The three keys below match what the admin client requires.

resource "pulsar_namespace" "namespace" {
  tenant = "public"
  namespace = "test"

  topic_auto_creation {
    allow = true
    type = "partitioned"
    partitions = 3
  } 
}
resource "pulsar_namespace" "namespace" {
  tenant = "public"
  namespace = "test"

  topic_auto_creation {
    allow = false
  } 
}

If allow is set to false then type and partitions should be optional.

Expose RuntimeFlags for Pulsar Functions / Connectors

Community Note

  • Please vote on this issue by adding a
    ๐Ÿ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

apache/pulsar-client-go#1204 exposed RuntimeFlags, and terraform provider should expose and allow user to customize the val as well.

New or Affected Resource(s)

  • pulsar_XXXXX

Potential Terraform Configuration

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

References

  • #0000

Unable to create sink while subscription_position is not specified

Terraform Version

  • 0.1.2 and 0.1.3

Affected Resource(s)

  • pulsar_sink

Terraform Configuration Files

locals {
  cloud_storage_sinks = {
    billing = {
      bucket  = "pulsar-billing"
      pattern = "persistent://billing/default/*"
      region  = "us-west-2"
    }
  }
}

resource "pulsar_sink" "cloud_storage_sink" {
  for_each = local.cloud_storage_sinks

  name                 = "cloud-storage-${each.key}"
  tenant               = "public"
  namespace            = "default"
  archive              = "builtin://cloud-storage"
  parallelism          = 1
  topics_pattern       = each.value.pattern
  auto_ack             = true
  cpu                  = 1
  ram_mb               = 1024
  disk_mb              = 10240
  cleanup_subscription = true
  configs              = jsonencode({
    bucket                = each.value.bucket
    region                = each.value.region
    role                  = "arn:aws:iam::123456789:role/pulsar-storage-connector-role"
    roleSessionName       = "name"
    provider              = "s3v2"
    formatType            = "json"
    partitionerType       = "partition"
    timePartitionPattern  = "yyyy-MM-dd"
    timePartitionDuration = "1h"
    batchSize             = 15000
    batchSizeMs           = 15000
  })
}

Debug Output

Panic Output

Stack trace from the terraform-provider-pulsar_v0.1.2 plugin:

panic: Error reading level config: '' expected type 'string', got unconvertible type 'utils.MessageID', value: '-1:-1:-1:-1'

goroutine 76 [running]:
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).get(0xc00008e100, {0xc00043c280, 0x1, 0x1}, 0x0?)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:553 +0x328
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).getChange(0xc00011ec80?, {0xcb701a?, 0x15?}, 0x27?, 0x0?)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:524 +0x1b8
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*ResourceData).diffChange(0xc0000bcc30?, {0xcb701a?, 0xcab40b?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource_data.go:501 +0x76
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diffString(0xc0000bcd78?, {0xcb701a, 0x15}, 0xc000470640, 0xc0000bcdd8, {0xddfa40, 0xc00008e100}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1521 +0xba
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.diff(0x6?, {0xddd598, 0xc0000fa5d0}, {0xcb701a, 0x15}, 0xc000470640, 0xc00008e000, {0xddfa40?, 0xc00008e100}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:1103 +0x16b
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.schemaMap.Diff(0xc00044d590, {0xddd598, 0xc0000fa5d0}, 0xc000517380, 0xc0000fb1d0, 0x0, {0xc7f140, 0xc000358b90}, 0x0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/schema.go:657 +0x333
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*Resource).SimpleDiff(0xdddd78?, {0xddd598?, 0xc0000fa5d0?}, 0xc000517380, 0xbc60a0?, {0xc7f140?, 0xc000358b90?})
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/resource.go:890 +0x6c
github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema.(*GRPCProviderServer).PlanResourceChange(0xc000195a10, {0xddd4f0?, 0xc00011e700?}, 0xc0003ee7d0)
	github.com/hashicorp/terraform-plugin-sdk/[email protected]/helper/schema/grpc_provider.go:741 +0x98c
github.com/hashicorp/terraform-plugin-go/tfprotov5/tf5server.(*server).PlanResourceChange(0xc0003aed20, {0xddd598?, 0xc000373dd0?}, 0xc000506e00)
	github.com/hashicorp/[email protected]/tfprotov5/tf5server/server.go:779 +0x515
github.com/hashicorp/terraform-plugin-go/tfprotov5/internal/tfplugin5._Provider_PlanResourceChange_Handler({0xc7ba60?, 0xc0003aed20}, {0xddd598, 0xc000373dd0}, 0xc00018df20, 0x0)
	github.com/hashicorp/[email protected]/tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go:367 +0x170
google.golang.org/grpc.(*Server).processUnaryRPC(0xc0001b6700, {0xde05f8, 0xc000003380}, 0xc00033d8c0, 0xc00044d6b0, 0x12a0668, 0x0)
	google.golang.org/[email protected]/server.go:1282 +0xccf
google.golang.org/grpc.(*Server).handleStream(0xc0001b6700, {0xde05f8, 0xc000003380}, 0xc00033d8c0, 0x0)
	google.golang.org/[email protected]/server.go:1619 +0xa1b
google.golang.org/grpc.(*Server).serveStreams.func1.2()
	google.golang.org/[email protected]/server.go:921 +0x98
created by google.golang.org/grpc.(*Server).serveStreams.func1
	google.golang.org/[email protected]/server.go:919 +0x28a

Error: The terraform-provider-pulsar_v0.1.2 plugin crashed!

This is always indicative of a bug within the plugin. It would be immensely
helpful if you could report the crash with the plugin's maintainers so that it
can be fixed. The output above should help diagnose the issue.

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

Able to create sink when subscription_position is specified.

The subscription_position should either be Earliest or Latest, but it's default value is using utils.Earliest instead.

Provider reports bug when Importing nonexistent resource

Terraform Version

Terraform v1.3.4
on darwin_amd64

Affected Resource(s)

  • pulsar_topic

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

โ”‚ Error: The provider returned a resource missing an identifier during ImportResourceState. This is generally a bug in the resource implementation for import. Resource import code should not call d.SetId("") or create an empty ResourceData. If the resource is missing, instead return an error. Please report this to the provider developers.

Resource import code should not call d.SetId("") or create an empty ResourceData.

If the resource is missing, instead return an error.

Panic Output

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

Support for schema compatibility strategy and validation enforce has been removed

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.1.2

Affected Resource(s)

Pulsar namespaces

Expected Behavior

schema_validation_enforce and schema_validation_enforce should be supported and configured on the namespaces

Actual Behavior

terraform plan returns an "Unsupported argument" for both params.

Steps to Reproduce

  1. create a new namespace
  2. add both parameters to namespace_config section
namespace_config {
     max_consumers_per_subscription = "50"
     schema_validation_enforce = true  
     schema_compatibility_strategy = ["ForwardTransitive"]
   }
  1. terraform plan

References

I noticed the support has been dropped in #31

Add offload policies in the pulsar_namespace resource

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Hi all!
In the company I work in, we are willing to enable infinite retention on some namespace and we are planning to offload them on S3 if they reach a certain size. We want to specify different threshold quotas for each namespace and have seen the possibility of doing that using Pulsar admin as described here (https://pulsar.staged.apache.org/docs/en/2.9.0/tiered-storage-aws/#example-3).
Seems that there is no property available on the pulsar_namespace resource to do the same through Terraform.
Do you have any plans to add it?

Impacted resources:

pulsar_namespace

Potential Terraform Configuration

resource "pulsar_namespace" "test" {
  tenant    = pulsar_tenant.test_tenant.tenant
  namespace = "eternals"

  enable_deduplication = true

  // If defined partially, plan would show difference
  // however, none of the mising optionals would be changed
  namespace_config {
    anti_affinity                  = "anti-aff"
    max_consumers_per_subscription = "50"
    max_consumers_per_topic        = "50"
    max_producers_per_topic        = "50"
    message_ttl_seconds            = "86400"
    replication_clusters           = ["standalone"]
  }

  dispatch_rate {
    dispatch_msg_throttling_rate  = 50
    rate_period_seconds           = 50
    dispatch_byte_throttling_rate = 2048
  }

  retention_policies {
    retention_minutes    = "1600"
    retention_size_in_mb = "10000"
  }
  
  // --- NEW OFFLOAD POLICIES HERE -- //
  offload_policies {
    threshold_size_in_mb = "10000"
  }

  backlog_quota {
    limit_bytes  = "10000000000"
    limit_seconds = "-1"
    policy = "consumer_backlog_eviction"
    type = "destination_storage"
  }

  persistence_policies {
    bookkeeper_ensemble                   = 1   // Number of bookies to use for a topic, default: 0
    bookkeeper_write_quorum               = 1   // How many writes to make of each entry, default: 0
    bookkeeper_ack_quorum                 = 1   // Number of acks (guaranteed copies) to wait for each entry, default: 0
    managed_ledger_max_mark_delete_rate   = 0.0 // Throttling rate of mark-delete operation (0 means no throttle), default: 0.0
  }

  permission_grant {
    role    = "some-role"
    actions = ["produce", "consume", "functions"]
  }
}

References

Add sink support

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

App pulsar_sink to terraform-provider-pulsar, which supports create, remove, import and update the sink resource.

New or Affected Resource(s)

  • pulsar_sink

In Progress

#38

400 Error when Updating Sinks and Sources with Terraform

Terraform apply results in a 400 bad request error when there are sinks/source present in the TF plan. They will apply correctly the first time, but every subsequent run will result in a 400, even if no changes are planned for the resource.

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform version 1.3.5
Pulsar provider version 0.1.3 (using v3 of API)

Affected Resource(s)

  • pulsar_sink
  • pulsar_source

Terraform Configuration Files

provider "pulsar" {
  alias           = "pulsar-v3"
  web_service_url = local.pulsar_web_service_url
  token           = var.pulsar_token
  api_version     = "3"
}

resource "pulsar_source" "pulsar_sqs_fallback" {
  provider               = pulsar.pulsar-v3
  name                   = "sqs-test"
  tenant                 = "public"
  namespace              = "default"
  destination_topic_name = "sqs-source-connector-test"
  archive                = "builtin://sqs"
  classname              = "org.apache.pulsar.ecosystem.io.sqs.SQSSource"
  parallelism            = 1
  cpu                    = 1
  ram_mb                 = 1024
  disk_mb                = 10240
  configs = jsonencode({
    awsEndpoint             = "https://sqs.${data.aws_region.current.name}.amazonaws.com"
    awsRegion               = data.aws_region.current.name
    queueName               = test-queue
    batchSizeOfOnceReceive  = 10
    numberOfConsumers       = 10
    awsCredentialPluginName = "org.apache.pulsar.io.aws.STSAssumeRoleProviderPlugin"
    awsCredentialPluginParam = jsonencode({
      roleArn         = "arn:aws:iam::xxxxxxxxx:role/test-role"
      roleSessionName = "name"
    })
  })
}

Expected Behavior

TF applies should work fine especially if no changes are being made to the sink/source.

Actual Behavior

Any subsequent apply results in this error, even if there are no changes to the plan

โ”‚ Error: code: 400 reason: 400 Bad Request
โ”‚ 
โ”‚   with pulsar_sink.cloud_storage_sink,
โ”‚   on pulsar_sinks.tf line 11, in resource "pulsar_sink" "cloud_storage_sink":
โ”‚   11: resource "pulsar_sink" "cloud_storage_sink" {

โ”‚ Error: code: 400 reason: 400 Bad Request
โ”‚ 
โ”‚   with pulsar_source.pulsar_sqs_fallback,
โ”‚   on pulsar_sources.tf line 28, in resource "pulsar_source" "pulsar_sqs_fallback":
โ”‚   28: resource "pulsar_source" "pulsar_sqs_fallback" {

Steps to Reproduce

  1. terraform apply once to create a source or sinks - works successfully
  2. terraform apply again - get 400 bad request

Important Factoids

References

  • #0000

Upgrade terraform-plugin-sdk to v2

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Terraform v0.12 or later requires terraform-plugin-sdk v2, so we need to do upgrade.

Form https://github.com/hashicorp/terraform-plugin-sdk#terraform-cli-compatibility.

New or Affected Resource(s)

  • pulsar_topic
  • pulsar_namespace
  • pulsar_tenant
  • pulsar_cluster

In Progress

Possibility to set compaction threshold for namespaces

Community Note

  • Please vote on this issue by adding a
    ๐Ÿ‘ reaction to the original
    issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra
    noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

There is no current possibility to set compaction threshold for namespaces.

Setting persistence_policy with no value result in a default of 0 being applied

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

terraform -v
Terraform v1.3.6
on darwin_amd64

Affected Resource(s)

  • persistence_policies

Terraform Configuration Files

persistence_policies {
bookkeeper_ensemble =
each.value["bookkeeper_ensemble"]
// Number of bookies to use for a topic, default: 0

bookkeeper_write_quorum =
each.value["bookkeeper_write_quorum"]
// How many writes to make of each entry, default: 0

bookkeeper_ack_quorum =
each.value["bookkeeper_ack_quorum"]
// Number of acks (guaranteed copies) to wait for each entry, default: 0

managed_ledger_max_mark_delete_rate
= each.value["managed_ledger_max_mark_delete_rate"]
// Throttling rate of mark-delete operation (0 means no throttle), default: 0.0
}

Expected Behavior

When no values are specified for bookkeeper_ensemble, bookkeeper_write_quorum, bookkeeper_ack_quorum and managed_ledger_max_mark_delete_rate, the value for each parameter should be null.

Actual Behavior

When no values are specified for bookkeeper_ensemble, bookkeeper_write_quorum, bookkeeper_ack_quorum and managed_ledger_max_mark_delete_rate, the value for each parameter is 0. As a result, when this is applied, producers cannot produce messages into the Pulsar cluster.

Steps to Reproduce

  1. terraform apply the above configuration

Important Factoids

  • This is also incorrect in the Pulsar docs, where the default for bookkeeper_ensemble, bookkeeper_write_quorum, bookkeeper_ack_quorum and managed_ledger_max_mark_delete_rate is listed as 0.

References

error when submitting `builtin` connectors

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Affected Resource(s)

  • pulsar_XXXXX

Terraform Configuration Files

resource "pulsar_sink" "streamnative_sink" {
# uses provider pointing to API v3
provider=pulsar.pulsar_v3 

archive="builtin://kinesis"
 ....
} 
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

Debug Output

Panic Output

"400 reason: Function Package url is not valid. supported url (function/sink/source)"

Expected Behavior

Actual Behavior

Steps to Reproduce

  1. terraform apply

Important Factoids

References

  • #0000

Are there any plans to support deploying schema for a topic via terraform?

Are there any plans to support deploying schema for a topic via terraform?

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

New or Affected Resource(s)

  • pulsar_topic

Potential Terraform Configuration

resource "pulsar_topic" "sample-topic-1" {
  tenant     = "public"
  namespace  = "default"
  topic_type = "persistent"
  topic_name = "partition-topic"
  partitions = 4                     # partitions > 0 means this is a partition topic
  schema = {
      name = "schema1"
      schema_type = AVRO
      schema = file(schema_file.avsc)
  }
}

`make` is a requirement

We should add make to the list of requirements of the readme. New VMs of ubuntu jammy don't have make by default.

apt install -y make is sufficient.

Implement namespace permission grants/roles and actions

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Implement namespace permission grants/roles and actions.

I'm working with an in-house developed terraform pulsar provider, but would like to rather adopt an open source project. The ability to add permission grants would be important for our adoption, and I'm willing to work on a pull request for this feature. I wanted to check here first and see if this was already planned, or if someone else was already working on it before I get too far along.

Potential Terraform Configuration

resource "pulsar_namespace" "test" {
  ...
  permission_grant {
    role = "my-consumer"
    actions = ["consume"]
  }
}

or something like

variable "pulsar_custom_client_roles" {
  type    = list(string)
  default = []
}

resource "pulsar_namespace" "test" {
  ...
  dynamic "permission_grant" {
    for_each = var.pulsar_custom_client_roles
    content {
      role    = permission_grant.value
      actions = ["consume", "produce"]
    }
  }
}

Topic not found error raised when setting retention policies on multiple topics

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

1.1.2

Affected Resource(s)

  • pulsar_topics

Terraform Configuration Files

An example can be found here

Debug Output

https://gist.github.com/esenac/097a3bba59f36e169c6f8b378ed91da9

Panic Output

Expected Behavior

Topic retention policies (the default ones in this case) are correctly set on the topics after the topics have successfully been created.

Actual Behavior

Topic level retention policies are not set because the declared topics seem not to exist on Pulsar even if they're in the same Terraform file.

Steps to Reproduce

  1. Declare a list of topics
  2. Loop the list to create topics resources in Terraform
  3. terraform apply

Important Factoids

The issue does not occur with a reduced amount of topics in the list.

References

Enable CI using Github Actions

Problem

We need to enable CI on this project to make sure all the pull requests merged to this repo are tested by CI.

Error: ERROR_CREATE_NAMESPACE_CONFIG: 2 errors occurred: SetNamespaceReplicationClusters code: 500

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

0.12.24

Affected Resource(s)

  • pulsar_namespace

Terraform Configuration Files

provider "pulsar" {
  web_service_url = "http://localhost:8080"
}

resource "pulsar_cluster" "my_cluster" {
  cluster = "my_cluster"

  cluster_data {
    web_service_url    = "http://broker.vivy.pulsar:8080"
    broker_service_url = "pulsar://broker.vivy.pulsar:6650"
  }
}

resource "pulsar_tenant" "my" {
  tenant           = "my"
  allowed_clusters = ["standalone", pulsar_cluster.my_cluster.cluster]
}

resource "pulsar_namespace" "events" {
  tenant    = pulsar_tenant.my.tenant
  namespace = "events"

  retention_policies {
    retention_minutes    = -1
    retention_size_in_mb = -1
  }
}

Debug Output

pulsar_cluster.my_cluster: Creating...
pulsar_cluster.my_cluster: Creation complete after 0s [id=my_cluster]
pulsar_tenant.my: Creating...
pulsar_tenant.my: Creation complete after 0s [id=my]
pulsar_namespace.events: Creating...

Error: ERROR_CREATE_NAMESPACE_CONFIG: 2 errors occurred:
        * SetNamespaceReplicationClusters: code: 500 reason: Unknown pulsar error
        * SetRetention: Post "http://localhost:8080/admin/v2/namespaces/my/events/retention": EOF



  on pulsar.tf line 19, in resource "pulsar_namespace" "events":
  19: resource "pulsar_namespace" "events" {

In the pulsar log:

16:38:32.400 [pulsar-web-57-16] WARN  org.eclipse.jetty.server.HttpChannel - /admin/v2/namespaces/my/events/replication
javax.servlet.ServletException: javax.servlet.ServletException: java.lang.NullPointerException
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:162) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:173) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.Server.handle(Server.java:494) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:374) [org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:268) [org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311) [org.eclipse.jetty-jetty-io-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103) [org.eclipse.jetty-jetty-io-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:117) [org.eclipse.jetty-jetty-io-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336) [org.eclipse.jetty-jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313) [org.eclipse.jetty-jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171) [org.eclipse.jetty-jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129) [org.eclipse.jetty-jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:367) [org.eclipse.jetty-jetty-util-9.4.20.v20190813.jar:9.4.20.v20190813]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_232]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_232]
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.43.Final.jar:4.1.43.Final]
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_232]
Caused by: javax.servlet.ServletException: java.lang.NullPointerException
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:432) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.apache.pulsar.broker.web.ResponseHandlerFilter.doFilter(ResponseHandlerFilter.java:53) ~[org.apache.pulsar-pulsar-broker-2.5.0.jar:2.5.0]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1591) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	... 17 more
Caused by: java.lang.NullPointerException
	at com.google.common.collect.Sets.newHashSet(Sets.java:259) ~[com.google.guava-guava-25.1-jre.jar:?]
	at org.apache.pulsar.broker.admin.impl.NamespacesBase.internalSetNamespaceReplicationClusters(NamespacesBase.java:462) ~[org.apache.pulsar-pulsar-broker-2.5.0.jar:2.5.0]
	at org.apache.pulsar.broker.admin.v2.Namespaces.setNamespaceReplicationClusters(Namespaces.java:254) ~[org.apache.pulsar-pulsar-broker-2.5.0.jar:2.5.0]
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_232]
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_232]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_232]
	at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_232]
	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory.lambda$static$0(ResourceMethodInvocationHandlerFactory.java:76) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:148) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:191) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$VoidOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:183) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:103) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:493) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:415) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:104) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:277) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:272) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:268) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:316) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:298) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.internal.Errors.process(Errors.java:268) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:289) ~[org.glassfish.jersey.core-jersey-common-2.27.jar:?]
	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:256) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:703) ~[org.glassfish.jersey.core-jersey-server-2.27.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:416) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:370) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:389) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:342) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:229) ~[org.glassfish.jersey.containers-jersey-container-servlet-core-2.27.jar:?]
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:852) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1604) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.apache.pulsar.broker.web.ResponseHandlerFilter.doFilter(ResponseHandlerFilter.java:53) ~[org.apache.pulsar-pulsar-broker-2.5.0.jar:2.5.0]
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1591) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:542) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1581) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:233) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1307) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:188) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:482) ~[org.eclipse.jetty-jetty-servlet-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1549) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:186) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1204) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:221) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146) ~[org.eclipse.jetty-jetty-server-9.4.20.v20190813.jar:9.4.20.v20190813]
	... 17 more
16:38:32.407 [pulsar-web-57-16] INFO  org.eclipse.jetty.server.RequestLog - 172.17.0.1 - - [02/Apr/2020:16:38:32 +0000] "POST /admin/v2/namespaces/my/events/replication HTTP/1.1" 500 0 "-" "None" 17

Panic Output

Expected Behavior

No errors

Actual Behavior

Seems when additional namespace configuration is not defined, then provider sends empty value and that is not ok for pulsar.

Seems non-defined configuration should be handled a bit differently

Steps to Reproduce

  1. terraform apply

Important Factoids

References

I can try to fix that

Support authentication using OAuth2

Description

New or Affected Resource(s)

  • Just Provider Configuration

Potential Terraform Configuration

provider "pulsar" {
  web_service_url = "http://localhost:8080"
  key_file_path = "/path/to/privateKey"
  issuer_url = "https://dev-kt-aa9ne.us.auth0.com"
  audience = "https://dev-kt-aa9ne.us.auth0.com/api/v2/"
  client_id = "0Xx...Yyxeny",
}

References

Incorrect examples

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

Terraform v1.0.10
on darwin_amd64

Expected Behavior

The example can work fine.

Actual Behavior

The example includes error syntax.

Steps to Reproduce

git clone https://github.com/streamnative/terraform-provider-pulsar
cd terraform-provider-pulsar
make build-dev
cd examples/namespaces
terraform init

Stack:

There are some problems with the configuration, described below.

The Terraform configuration must be valid before initialization so that
Terraform can determine which modules and providers need to be installed.
โ•ท
โ”‚ Error: Invalid required_providers object
โ”‚ 
โ”‚   on main.tf line 21, in terraform:
โ”‚   21:       versions = ["1.0.0"]
โ”‚ 
โ”‚ required_providers objects can only contain "version", "source" and "configuration_aliases" attributes. To configure a provider, use a
โ”‚ "provider" block.
โ•ต

Replace pulsarctl with pulsar-admin-go

Motivation

The pulsar-admin-go is a package for pulsar admin operations, providing a unified Go API for managing pulsar resources such as tenants, namespaces and topics, etc.

Add source resource support

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

App pulsar_source to terraform-provider-pulsar, which supports create, remove, import and update the sink resource.

New or Affected Resource(s)

  • pulsar_source

[bug][replication]: when destroying resources with replication configs, provider should cleanup the replication config first

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform Version

v1.0.3

Affected Resource(s)

  • pulsar_tenant
  • pulsar_namespace

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key: https://keybase.io/hashicorp

provider "pulsar"{
    alias = "us-east"
    web_service_url = ""
    issuer_url = ""
    audience = ""
    key_file_path = ""
}

resource "pulsar_cluster" "us-west-cluster" {
  provider = pulsar.us-east
  cluster = "us-west"

  cluster_data {
    web_service_url    = "<web_service_url>"
    broker_service_url = "<broker_service_url>"
  }
}

resource "pulsar_tenant" "us-east-geo-tenant" {
  provider = pulsar.us-east
  tenant = "geo-tenant"
  allowed_clusters = [
    "us-east",
    pulsar_cluster.us-west-cluster.cluster
  ]
}

resource "pulsar_namespace" "us-east-geo-namespace" {
  provider  = pulsar.us-east
  tenant    = pulsar_tenant.us-east-geo-tenant.tenant
  namespace = "geo-namespace"

  namespace_config {
    replication_clusters = [
      "us-east",
      pulsar_cluster.us-west-cluster.cluster
    ]
  }
}

Debug Output

Panic Output

Expected Behavior

Destroy successfully.

Actual Behavior

pulsar_namespace.us-east-geo-namespace: Destroying... [id=geo-tenant/geo-namespace]
pulsar_namespace.us-west-geo-namespace: Destroying... [id=geo-tenant/geo-namespace]
โ•ท
โ”‚ Error: ERROR_DELETE_NAMESPACE: code: 412 reason: Cannot delete the global namespace geo-tenant/geo-namespace. There are still more than one replication clusters configured.
โ”‚
โ”‚
โ•ต
โ•ท
โ”‚ Error: ERROR_DELETE_NAMESPACE: code: 412 reason: Cannot delete the global namespace geo-tenant/geo-namespace. There are still more than one replication clusters configured.
โ”‚
โ”‚
โ•ต

Steps to Reproduce

  1. terraform apply to create resources
  2. terrafrom destroy to cleanup resources

Important Factoids

References

  • I believe this issue is because Pulsar requires to remove the replication configurations on tenant, namespace first then allow to delete this resource.
  • So for the terraform provider should check the replication configuration first before the destroy.

Function resource

Community Note

  • Please vote on this issue by adding a ๐Ÿ‘ reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Would be nice to have a function definition as a resource.

New or Affected Resource(s)

  • pulsar_function

Potential Terraform Configuration

resource "pulsar_function" "function_example" {
  tenant     = "public"
  namespace  = "default"
  topics_pattern: "topic-*",
  processing_guarantee: "at-least-once",
  runtime: "java",
  fqfn: "my_function",
  name: "my_func",
  class_name: "com.example.Func",
  secrets:  {
     token = "secret"
  }
}

References

I think lambdas could be used for the inspiration
https://www.terraform.io/docs/providers/aws/r/lambda_function.html
https://github.com/terraform-providers/terraform-provider-aws/blob/master/aws/resource_aws_lambda_function.go

or https://www.terraform.io/docs/providers/google/r/cloudfunctions_function.html

I can try to implement some naive implementation to get it working and grab some feedback

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.