-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding support for Terraform plan target #97
Conversation
…orm. Added new flag under run_create.go and run.go to add support for providing Terraform targets to the run.
…uns. Updated run_create and run documentation for target.
@trutled3 Thanks for opening a PR and adding a test case! My team and I will review this today. |
…string return a string representation of the value of the flag within the flagStringSlice.String() function.
…t=aws_resourrce.test_2,aws_resource.test_3 or --target=aws_resource.test --target=aws_resourrce.test_2,aws_resource.test_3
Great catch @mjyocca . I've made that change and verified on my end. It is ready for your review! |
Awesome thank you for doing that! Also out of curiosity. What sort of workflows or scenarios from an automation standpoint will this enable for you? (Example for GitHub Actions, dispatch a workflow passing in the target resources etc.) |
Certainly @mjyocca ! That is my mistake for not including that in my PR. The TLDR is that this allows us to target specific resources to update as part of a development lifecycle without affecting other resources in the same Terraform deployment. I have a few use cases that largely surround have a resource managed with Terraform however updating a specific resource as part of another CI CD process such as building and deploying a new image version to my AWS ECR and then update the resources that leverage this image automatically as part of my CI CD lifecycle. The targeted plan allows for planning changes to just the particular resources instead of planning the entire deployment which may have other working changes that we don't want deployed. Another use case I have is building and releasing new lambda layer versions, and then updating the associated lambdas to use that newly released lambda layer version by updating the a variable the Terraform deployment uses and having Terraform update the Lambda with that new layer version. |
I see thanks for clarifying! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Description
This pull request adds the capability to create a Terraform run using the target option to focus Terraform to specific resources.
Testing plan
Build tfci, go build
export TF_API_TOKEN=<TOKEN>
export TF_CLOUD_ORGANIZATION=<ORG>
Run tfci,
tfci -hostname=<HOST> -organization=<ORG> run create -workspace=<WORKSPACE> -target-addr=aws_instance.foo
External links