How to create resource only on first run

Hello,

Do we have architectural opinion on the following topic?

How properly put resource into the module but make it executed only first time and used in others.

E.g.: We have a module with glue jobs integration. This module reused many times. To enforce security we want to use aws_glue_security_configuration resources but:

  • don’t want same config being created as many times as module used;
  • want it to be created on first call and after reused;
  • can’t not bring configuration as en external dependency;
  • really don’t want to use local exec to make that decision in runtime.

Regards,
Serhii

Seems like a deadlock

There is no data source you can use in that case, so for every glue job, you’ll need a new aws_glue_security_configuration resource to be created.

1 Like