Closed pathcl closed 3 years ago
I think I figured it out. Now I'd only need multiple providers maybe.
$ cat create-config.py
import terrascript
import terrascript.resource
config = terrascript.Terrascript()
for item in ['one', 'two']:
config += terrascript.resource.rabbitmq_shovel(item, name="imyshovel",vhost=item, info={"source_uri": "ampq:///source", "destination_uri": "ampq:///test"})
print(config)
$ terraform plan
Refreshing Terraform state in-memory prior to plan...
The refreshed state will be used to calculate this plan, but will not be
persisted to local or remote state storage.
------------------------------------------------------------------------
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
+ create
Terraform will perform the following actions:
# rabbitmq_shovel.one will be created
+ resource "rabbitmq_shovel" "one" {
+ id = (known after apply)
+ name = "imyshovel"
+ vhost = "one"
+ info {
+ ack_mode = "on-confirm"
+ destination_add_timestamp_header = false
+ destination_protocol = "amqp091"
+ destination_uri = (sensitive value)
+ reconnect_delay = 1
+ source_protocol = "amqp091"
+ source_uri = (sensitive value)
}
}
# rabbitmq_shovel.two will be created
+ resource "rabbitmq_shovel" "two" {
+ id = (known after apply)
+ name = "imyshovel"
+ vhost = "two"
+ info {
+ ack_mode = "on-confirm"
+ destination_add_timestamp_header = false
+ destination_protocol = "amqp091"
+ destination_uri = (sensitive value)
+ reconnect_delay = 1
+ source_protocol = "amqp091"
+ source_uri = (sensitive value)
}
}
Plan: 2 to add, 0 to change, 0 to destroy.
------------------------------------------------------------------------
Note: You didn't specify an "-out" parameter to save this plan, so Terraform
can't guarantee that exactly these actions will be performed if
"terraform apply" is subsequently run.
Hey there! thanks for making this project open source.
Im trying to create 2 resources out of the same provider however:
Is there an example I can imitate? I couldn't find anything