{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/1178","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/1178/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/1178/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/1178/events","html_url":"https://github.com/hashicorp/terraform/issues/1178","id":60632212,"number":1178,"title":"Depends_on for module","user":{"login":"felnne","id":7847612,"avatar_url":"https://avatars.githubusercontent.com/u/7847612?v=3","gravatar_id":"","url":"https://api.github.com/users/felnne","html_url":"https://github.com/felnne","followers_url":"https://api.github.com/users/felnne/followers","following_url":"https://api.github.com/users/felnne/following{/other_user}","gists_url":"https://api.github.com/users/felnne/gists{/gist_id}","starred_url":"https://api.github.com/users/felnne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felnne/subscriptions","organizations_url":"https://api.github.com/users/felnne/orgs","repos_url":"https://api.github.com/users/felnne/repos","events_url":"https://api.github.com/users/felnne/events{/privacy}","received_events_url":"https://api.github.com/users/felnne/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/hashicorp/terraform/labels/core","name":"core","color":"cccccc"},{"url":"https://api.github.com/repos/hashicorp/terraform/labels/thinking","name":"thinking","color":"fad8c7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-03-11T09:39:55Z","updated_at":"2015-10-03T03:56:16Z","closed_at":null,"body":"This issue was promoted by [this]() question on Google Groups.\r\n\r\nTerraform version: `Terraform v0.3.7`\r\n\r\n#### Original problem\r\n\r\nI have two terraform modules for creating a digital ocean VM and DNS records that are kept purposely modular so they can be reused by others in my organisation.\r\n\r\nI want to add a series of provisioners using local_exec after a VM has been created and DNS records made.\r\n\r\n#### Attempted solution\r\n\r\nI tried adding a provisioner directly to my terraform file (i.e. not in a resource) which gave an error.\r\n\r\nI then tried using the `null_resource` which worked but was executed at the wrong time as it didn't know to wait for the other modules to execute first.\r\n\r\nI then tried adding a `depends_on` attribute to the null resource using a reference to a module but this doesn't seem to be supported using this syntax:\r\n\r\n```\r\ndepends_on = [\"module.module_name\"]\r\n```\r\n\r\n#### Expected result\r\n\r\nEither a way for a resource to depend on a module as a dependency or a way to \"inject\" (for lack of a better word) some provisioners for a resource into a module without having to make a custom version of that module (I realise that might be a separate issue but it would solve my original problem).\r\n\r\n#### Terraform config used\r\n\r\n```\r\n# Terraform definition file - this file is used to describe the required infrastructure for this project.\r\n\r\n# Digital Ocean provider configuration\r\n\r\nprovider \"digitalocean\" {\r\n\ttoken = \"${var.digital_ocean_token}\"\r\n}\r\n\r\n\r\n# Resources\r\n\r\n# 'whoosh-dev-web1' resource\r\n\r\n# VM\r\n\r\nmodule \"whoosh-dev-web1-droplet\" {\r\n    source = \"github.com/antarctica/terraform-module-digital-ocean-droplet?ref=v1.0.0\"\r\n    hostname = \"whoosh-dev-web1\"\r\n    ssh_fingerprint = \"${var.ssh_fingerprint}\"\r\n}\r\n\r\n# DNS records (public, private and default [which is an APEX record and points to public])\r\n\r\nmodule \"whoosh-dev-web1-records\" {\r\n    source = \"github.com/antarctica/terraform-module-digital-ocean-records?ref=v0.1.1\"\r\n    hostname = \"whoosh-dev-web1\"\r\n    machine_interface_ipv4_public = \"${module.whoosh-dev-web1-droplet.ip_v4_address_public}\"\r\n    machine_interface_ipv4_private = \"${module.whoosh-dev-web1-droplet.ip_v4_address_private}\"\r\n}\r\n\r\n\r\n# Provisioning (using a fake resource as provisioners can't be first class objects)\r\n\r\n# Note: The \"null_resource\" is an undocumented feature and should not be relied upon.\r\n# See https://github.com/hashicorp/terraform/issues/580 for more information.\r\n\r\nresource \"null_resource\" \"provisioning\" {\r\n\r\n    depends_on = [\"module.whoosh-dev-web1-records\"]\r\n\r\n    # This replicates the provisioning steps performed by Vagrant\r\n    provisioner \"local-exec\" {\r\n        command = \"ansible-playbook -i provisioning/development provisioning/bootstrap-digitalocean.yml\"\r\n    }\r\n}\r\n```\r\n\r\n(P.s. I wasn't quite sure how to word/structure this, apologies if i've missed anything out)."},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/145198476","html_url":"https://github.com/hashicorp/terraform/issues/1178#issuecomment-145198476","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/1178","id":145198476,"user":{"login":"ketzacoatl","id":10122937,"avatar_url":"https://avatars.githubusercontent.com/u/10122937?v=3","gravatar_id":"","url":"https://api.github.com/users/ketzacoatl","html_url":"https://github.com/ketzacoatl","followers_url":"https://api.github.com/users/ketzacoatl/followers","following_url":"https://api.github.com/users/ketzacoatl/following{/other_user}","gists_url":"https://api.github.com/users/ketzacoatl/gists{/gist_id}","starred_url":"https://api.github.com/users/ketzacoatl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ketzacoatl/subscriptions","organizations_url":"https://api.github.com/users/ketzacoatl/orgs","repos_url":"https://api.github.com/users/ketzacoatl/repos","events_url":"https://api.github.com/users/ketzacoatl/events{/privacy}","received_events_url":"https://api.github.com/users/ketzacoatl/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T03:56:16Z","updated_at":"2015-10-03T03:56:16Z","body":"@roboll, you might benefit from the `-target` attr for the `apply` and `plan` subcommands."}}