Apply a subset of changes with terraform apply

1,773 views
Skip to first unread message

chri...@agentlemanandascholar.me

unread,
Apr 12, 2018, 9:55:43 AM4/12/18
to Terraform
Hi everyone!

Is there a way to run only a subset of infrastructure changes listed in terraform plan? I know I can apply one singular change using the -target flag but is there a way to specify more than one change or ask terraform to apply all changes except one?

⁞ Fernando Miguel

unread,
Apr 12, 2018, 9:59:31 AM4/12/18
to terrafo...@googlegroups.com
keep adding -targets 

-- 

On Thu, Apr 12, 2018 at 2:55 PM, <chri...@agentlemanandascholar.me> wrote:
Hi everyone!

Is there a way to run only a subset of infrastructure changes listed in terraform plan? I know I can apply one singular change using the -target flag but is there a way to specify more than one change or ask terraform to apply all changes except one?

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/55990504-1179-40c7-b05c-52d137a3d971%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Christian M. Ghigliotty

unread,
Apr 12, 2018, 10:23:10 AM4/12/18
to terrafo...@googlegroups.com
Thank you Fernando.

Is this example syntax for specifying multiple targets accurate —

terraform apply -target=google_project_iam_role.viewer-role -target=google_project_iam_role.editor-role

On Thu, Apr 12, 2018 at 9:58 AM, ⁞ Fernando Miguel <tl...@fernandomiguel.net> wrote:
keep adding -targets 

-- 

⁞ Fernando Miguel

unread,
Apr 12, 2018, 10:49:52 AM4/12/18
to terrafo...@googlegroups.com

ja...@fpcomplete.com

unread,
Apr 13, 2018, 1:07:39 AM4/13/18
to Terraform


On Thursday, April 12, 2018 at 9:55:43 AM UTC-4, chri...@agentlemanandascholar.me wrote:
Hi everyone!

Is there a way to run only a subset of infrastructure changes listed in terraform plan? I know I can apply one singular change using the -target flag but is there a way to specify more than one change or ask terraform to apply all changes except one?

If you find yourself wanting to do this a lot, it might be a place to consider separating those resources into different Terraform env/projects. For example, it's not crazy to split up your core VPC/network from RDS and from the ASG you run a bunch of web apps on. It depends on the nuances of the team, constraints, desired workflow, etc.
Reply all
Reply to author
Forward
0 new messages