Using Terraform in Azure DevOps Pipelines PART 1
Вставка
- Опубліковано 5 вер 2024
- This video shows you how to create a Terraform Azure DevOps pipeline that can be leveraged to create Azure Cloud resources. Watch PART 2 where I show you how to templatize this pipeline ( • Using Terraform in Azu... ).
Music by OctoberMusic: / octobermusic-1
Man this made my day, been looking for a 'from scratch' TF pipeline procedure and haven't been able to find one nearly as helpful till today. Thanks for doing this!!
I'm glad this helped guide you. Thanks for watching.
Hello, you are a savior for all the people looking for the automation of terraform in azure Devops.
May god bless you !
Highly appreciated !
I really appreciate the feedback and do plan on continuing my videos on infrastructure as code as well as other DevOps topics. Please make sure to show appreciation by subscribing to the channel and liking the video.
All those who are having trouble regarding the access as contributor, *DO NOT* mention any resource group while creating service principal (inside service connection in Azure DevOps). It worked for me !
No Nonsense explanations - straight to the actions with brief info. Too good video
I'd say this video is exceptional, on point, and clearly explains how to use Terraform in Azure DevOps Pipeline. Thank you very much, you've made my day and greatly appreciate you.
Thanks for the feedback it's much appreciated.
@@skunklabz Do you mind sharing the exact thing you did to fix the issue when the Apply task failed as a result of Service Principal not properly scoped. Please kindly share that experience.
I figured out how that issue was fixed. In my own case I used Azure Resource Manager > Service Principal (manual) authentication method when creating the Service Connections of the DevOps project. Obviousely the Service Principal Key was actually required using this approach. Thought I should share.
Thanks for sharing the solution.
Thanks for providing great audio quality🎉 Nice work
Thanks for your feedback! It's very much appreciated. Please make sure to subscribe the channel to encourage more future content.
Excellent stuff . Nice that I had a chance to start my work with the 90% match
Thanks for watching and I appreciate the feedback.
what you mean 90% match?
Thank you ! this is exactly the video that I've been looking for :-) thank you
one of the best demonstration... awesome man many many thanks...
Thanks for stopping by, I appreciate the comments. Make sure to subscribe!
this was a really WOW, but please add the troubleshooting video also it would really help us in future . thanks alot for the video
Sure thing!
Great stuff...plus kudos for Cheech going blind mode!
Glad you liked the reference! :)
Best video and best explanation. Cheers.
that's amazing, thank you so much, keep them coming
I know I've been lagging. I am working on my next videos. Soon to be released.
Hello, This video is amazing and very helpful to me. Step by step instructions that you have given is very easy to understand. Thanks for posting this !!
Thank you for your feedback. Please make sure to subscribe and like to show your support.
Subscribed to your channel! Keep posting! Cheers !!
1 minute in the video start loving it ! great work watched and enjoyed the full video keep up the good work
Thank you so much! I appreciate the support.
Thank you! Very helpful to me too!
Glad it helped!
Great video. Very useful. Thank u so much.
Thank you for watching!
Great video, easy to understand. Thanks .
Thanks for stopping by and watching! If you haven't done so, please make sure to like and subscribe.
this is perfect, thanks!!
Thanks man this was so useful!
Glad it helped!
Great video
Thank you!
Thanks for the VDO , I was looking for this from last few days, its quite helpful. Here you used MS defined agent pool. if I want use a self hosted agentpool what extra steps do i need to do.
It should be the same but it must have all the prerequisites installed.
Thank you. I appreciate you...
Thanks for stopping by!
@@skunklabz, I have been receiving a "Service returned an error. Status=403 Code="AuthorizationFailed" Any suggestions? Thank you in advance...
403 is forbidden but doesn't tell you much on what the underlying issue could be.
Hey, I'm facing an error that says unexpected value environment, continueOnError and strategy. Any help would be appreciated!
Thanks bro. Defo subscribing for more 👌
Thanks for watching!!
Can we create the pipeline using terraform by using the existing service principal?
From one perspective it shows a lot, from other It does take a lot of assumptions. Why do we need all the things at the beginning? What they are for? Can we create them using terraform? ... Many questions
Those are all prerequisites to create the Terraform steps.
Thank you Sir
No problem.
Hi. Great video. Do you have resource recommendations where I can use to master Azure DevOps with terraform? Thanks
Excellent !!!
Thank you for watching!
in your video using command you had created "skftcontainer" container but in terraform code you are using terraform.tfstate name of container why?
Im still getting the authorization/authentication error during the stage:apply even after adding role assignment at subscription level.
Please check the comments here as there is someone that resolved the issue and posted what to do. It's been almost two years and don't remember what I did from the top of my head other than what I said in the video.
Can anyone help me how did we make use of service principal did we used it in service connection? bcz in service connection we had mentioned "Azure resource manager" and then selected RG and before we had authenticate and we did even mentioned the "SP" in the terraform script. So why did we create SP in start
That's because you have to create a service principal first before even attempting to authenticate.
Hi can you please help how we can use of parameters and inject the values while running the pipeline ? Instead of hard coding
That's covered in part 2 of this video. Go check it out.
So, if you use Git to store your Terraform code, when you push PR to Git, how can you have it automatically run init and plan and not apply until the PR is approved,
The pipeline would need to be modified to work on different triggers like on PR. This example I have here is just a high-level idea of what folks can do. How people implement is up to them. Everyone has different workflows and I can't cover all scenarios. Good point though.
Nice quick demo! for the 'backend' in .tf file there is this line: "resource_group_name = "tstate"" what does this line mean? We do not have such an rg named 'tstate' in subscription. Also there is no storage key provided either, so how could terraform access it? It works but cannot understand how. Also how did the azure-pipelines.yml found the terraform.tf? It checks for this file in root?
That would be the resource group name you are going to use.
@@skunklabz going to use for ?
All resources in Azures require them to be associated with a resource group. What I meant was you can use an existing resource group that has been previously created, or as in this case, create a new one.
Hi,, How did you resolve last error while deploying. I am still getting the same error after giving contributor role for myself to subscription
I believe I explained it in some other comment made here. But it had to do with granting the service principal the proper permissions.
if i am using classic pipeline in azure DevOps, and i want to make some enhancements and value in my environment, then how can i leverage terraform for that?
You can use the same tasks in classic pipelines to get the same benefit.
can you please provide YAML pipeline for CI/CD or githut location URL please ... i tried all the steps that in the above video
Sure: dev.azure.com/skunklabz/public/_git/terraform
Thanks a ton
Can you suggest a way to work with Terraform workspaces in devops?
That's a very good topic to bring up and something I'd like to cover in the future. Thank you for valuable feedback.
@@skunklabz Will you be able to project a timeline for that?
Not at the moment.
@@skunklabz Ok. thanks
if i am using classic pipeline in azure devops, and i want to make some enhancements and value in my environment,,then how can i leverage terraform for that?
i am also yet to introduce containers, microservices in my environment and i work on ON-PREM environment.
Hi Rohit, I'm not too clear on what your ask is but Terraform can be run from either classic pipeline or pipeline as code. That's separate from Terraform itself.
@@skunklabz
I see, you have any resources where i can learn how to use terraform from classic pipeline, and also i am trying to ask is that what benefits will i get by using terraform in my environment and currently there are no containers but i am planning to enhance it by introducing containers annd working on docker and kubernetes stuff and transition to devsecops too, so all i am tring to ask is, what value i can add through terraform in my environment?
I hope it helps?
Hi Rohit. Terraform is primarily for managing resources in cloud using infrastructure as code. It's dependent on what cloud provider you're using and what resources you want to manage. Leveraging Terraform you can automate using pipelines with any CI tool not just Azure DevOps. In this video I just showed one particular example. There are many ways you can leverage Terraform.
@@skunklabz
well right now i am not using any cloud environment, i have ON PREM environment, and we have azure devops servers which are connected to those ON PREM servers, so can i leverage terraform for introducing containers in my environment?
Unless you are hosting private cloud I'm not clear on how else you could leverage it for your needs. Containerization doesn't depend on something like Terraform.
how to give contributor role to my service principle at 16:35,, please advice
I followed this: docs.microsoft.com/en-us/azure/role-based-access-control/role-assignments-portal
@@skunklabz Thanks but my Service principle has contributor role, but it still does not work, please advice
@@abdulthakur5608 yeah that's what I did so not sure how to solve your issue. Sorry.
Please make more videos on azure DevOps
@@atanudebnath9173 they're coming!! ;)
Hey, thank you. Do you have the code?