Skip to content

Allow to specify servers / user in resource instead of provider #101

@jvanhees

Description

@jvanhees

What motivated this proposal?

First off, I just started working with Terraform, so I'm unsure if this is even feasible.

We are building a single-tenant architecture where we are running separate a separate NATS instance for each client. This NATS instance has a JetStream stream which is configured using Terraform.

We've added modules for each of our components in our system, including a NATS module that sets up a GCP Compute Engine with the NATS Docker image, adds networking, firewalls, etc etc. Ideally, this module also configures the JetStream Stream, but because of the JetStream provider we cannot use depends_on to only configure JetStream once the Compute Engine is running. We also don't know the instance IP address because (when we create a new environment using the module) there is no instance created yet.

What is the proposed change?

I would like to be able to specify the user and servers within the resource, which in turn overrides the values configured in the provider. This is also how Google Cloud Platform handles it with the project value (you can configure it in the provider, or set it for each resource individually which overrides the value inherited from the provider).

Who benefits from this change?

It would be easier to configure JetStream in Terraform modules, especially when Terraform also configures the instances on which JetStream runs.

What alternatives have you evaluated?

When using the provider, Terraform considers the module a "legacy module", with this error:

Error: Module is incompatible with count, for_each, and depends_on
│ ...
│ 
│ The module at module.nats is a legacy module which contains its own local provider configurations, and so calls to it may not use the count, for_each, or depends_on
│ arguments.
│ 
│ If you also control the module "../../components/nats", consider updating this module to instead expect provider configurations to be passed by its caller.

I cannot pass a provider because the instance IP is still unkown.

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalEnhancement idea or proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions