1. Нам важно Ваше мнение!
    и обсуждайте вместе! Нажимайте "мне нравится" и рекомендуйте друзьям ;)
    Понравилось тема? Напишите в ней свой отзыв.
    Считаете что тема не достаточно полно раскрыта? Расскажите свою точку зрения!
    С Вашей помощью сделаем форум еще лучше!

Newport News : devops for databases - Kabrinskiy Eduard

Тема в разделе 'Горячие новости для тех кто следит за собой', создана пользователем IZRAELEn, 23 май 2021.

  1. IZRAELEn

    IZRAELEn Member

    Эдуард Кабринский - Terraform azure devops - Eduard Kabrinskiy


    <h1>Terraform azure devops</h1>
    <p>[youtube]</p>
    Terraform azure devops <a href="http://remmont.com">Current news events</a> Terraform azure devops
    <h1>Azure DevOps Terraform Pipeline</h1>
    <p>In my last post I wrote about how I created an Azure DevOps pipeline using Ansible in a more "Terraform" way, however, although I have used Terraform and Azure DevOps quite a bit I realised I didn't really have a template for a pipeline.</p>
    <h2>Russ McKendrick</h2>
    <p>Read more posts by this author.</p>
    <h4>Russ McKendrick</h4>
    <p style="clear: both"><img src="https://www.mediaglasses.blog/content/images/size/w2000/2020/05/azure-devops-terraform.png" /></p>
    <p>In my last post I wrote about how I created an Azure DevOps pipeline using Ansible in a more "Terraform" way, however, although I have used Terraform and Azure DevOps quite a bit I realised I didn't really have a template for a pipeline.</p>
    <p>Before we look at the pipeline itself I should point out that is uses the the Terraform Azure Pipeline extension by Microsoft DevLabs from the Visual Studio Marketplace, if you are following along with this post please ensure that the extension is installed in your organisation before proceeding.</p>
    <p>Now we have that out of the way, and before I breakdown the azure-pipelines.yml file, lets quickly get an overview of what the tasks which are running in the pipeline;</p>
    <p style="clear: both"> <img src="https://www.mediaglasses.blog/content/images/2020/05/azure-devops-terraform-pipeline-01-1.png" /></p>
    <p>As you can see from the flow of tasks above I am creating the storage account used to store the Terraform state file as part of the pipeline itself rather than doing manually outside of the pipeline. In nearly all of my Azure DevOps pipelines I see the following variable as SUBSCRIPTION_NAME which contains the name of the service connection that should be used to connect to Azure, wherever you see $(SUBSCRIPTION_NAME) in the following tasks that is referring to the service connection.</p>
    <p>The azure-pipelines.yml file starts of by defining the trigger, in this case it is triggered each time something is pushed to the master branch:</p>
    <p>Next, I define some variables, apart from tf_version which fines which version of Terraform I want to install the rest are to do with the Terraform state file resources which need to be configured before I run Terraform:</p>
    <p>Then we decide on the image used for the pipeline run, as you may have guessed, I am using Linux:</p>
    <p>Now that the basics for the pipeline are covered I can start to define some tasks, beginning with installing Terraform:</p>
    <p>As you can see, I am using the terraformInstaller@0 task from the Terraform DevOps extension along with the $(tf_version) which was defined at the top of the file. Now that Terraform is installed I need to either create the storage account, or if it already exists gather some facts. To do this I am using the AzureCLI@2 task:</p>
    <p>As you can see I am running a quite a few commands, these do the following:</p>
    <p><ol>
    <li>Sets an environment variable containing the tags defined in the pipeline variables</li>
    <li>Creates a Resource Group and tags it</li>
    <li>Creates the Azure Storage Account and tags it</li>
    <li>Sets an environment variable containing the Storage Account key</li>
    <li>Creates a container in the Azure Storage Account which has just been created using the key gathered in the previous step</li>
    <li>Adds the Azure Storage Account key as a pipeline variable so that we can use it in the next task</li>
    </ol>
    </p>
    <p>If the Resource Group, Azure Storage Account and container already exist then we still need the Azure Storage Account key so this task needs to be executed during each pipeline run as the following task needs to interact with the Azure Storage account:</p>
    <p>Here I am running terraform init and passing all of the variables which tell Terraform how to configure the AzureRM backend service with the details of the Azure Storage account I configured in the previous task. Once the terraform init has been executed we do not need to pass the AzureRM backend service details again. The final two tasks plan and apply the Terraform configuration:</p>
    <p>As you can see I am providing rather than using backendServiceArm I am using environmentServiceNameAzureRM , this means that if I wanted I could store my Terraform state file(s) in a completely separate Azure Subscription from where I am deploying my resources should I want to.</p>
    <h2>Terraform azure devops</h2>

    <h3>Terraform azure devops</h3>
    <p>[youtube]</p>
    Terraform azure devops <a href="http://remmont.com">American news headlines</a> Terraform azure devops
    <h4>Terraform azure devops</h4>
    I previously wrote about how I created a DevOps pipeline using Ansible in a more Terraform way, in this post I will look a little more at what that means.
    <h5>Terraform azure devops</h5>
    Terraform azure devops <a href="http://remmont.com">Terraform azure devops</a> Terraform azure devops
    SOURCE: <h6>Terraform azure devops</h6> <a href="https://dev-ops.engineer/">Terraform azure devops</a> Terraform azure devops
    #tags#[replace: -,-Terraform azure devops] Terraform azure devops#tags#

    Кабринский Эдуард
    current news

Поделиться этой страницей