title: How to reuse a terraform resource?
body: <p>I'm pretty much new to terraform. I wanted to know is there a way to reuse a resource? Below is my code. Below is the main.tf, where I have a module declared.</p>
  <pre><code>module &quot;deployments&quot; {
    source = &quot;./modules/odo_deployments&quot;
    artifact_versions = local.artifact_versions
  }
  </code></pre>
  <p>In the modules/odo_deployments folder, I have two resources which does exactly the same except for a different ad. Is there a way I can use just one resource and pass arguments (ad) like a function to this resource?</p>
  <pre><code>variable &quot;artifact_versions&quot; {
    description = &quot;What gets injected by terraform at the ET level&quot;
  }
  
  resource &quot;odo_deployment&quot; &quot;incident-management-service-dev&quot; {
      count = var.artifact_versions[&quot;incident-management-service&quot;].version == &quot;skip&quot; ? 0 : 1
      ad = &quot;phx-ad-1&quot;
      alias = &quot;cloud-incident-management-application&quot;
      artifact {
          url = var.artifact_versions[&quot;incident-management-service&quot;].uri
          build_tag = var.artifact_versions[&quot;incident-management-service&quot;].version
          type = var.artifact_versions[&quot;incident-management-service&quot;].type
      }
  
      flags = [&quot;SKIP_UP_TO_DATE_NODES&quot;]
  }
  
  resource &quot;odo_deployment&quot; &quot;incident-management-service-dev-ad3&quot; {
      count = var.artifact_versions[&quot;incident-management-service&quot;].version == &quot;skip&quot; ? 0 : 1
      ad = &quot;phx-ad-3&quot;
      alias = &quot;cloud-incident-management-application&quot;
      artifact {
          url = var.artifact_versions[&quot;incident-management-service&quot;].uri
          build_tag = var.artifact_versions[&quot;incident-management-service&quot;].version
          type = var.artifact_versions[&quot;incident-management-service&quot;].type
      }
  
      flags = [&quot;SKIP_UP_TO_DATE_NODES&quot;]
  }
  </code></pre>