Skip to content

Commit

Permalink
fix: Azure devops migration from azurerm v2 version (#23)
Browse files Browse the repository at this point in the history
* allign with azurerm v2 version

* updated docs
  • Loading branch information
diegolagospagopa authored Jan 9, 2023
1 parent 4517ef3 commit 8d259f5
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 3 deletions.
2 changes: 1 addition & 1 deletion application_insights_web_test_preview/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Application insights we test preview

This module allow to create an alert for the fqdn host
This module create an alert for a host and verify that is up and running

## How to use

Expand Down
38 changes: 38 additions & 0 deletions azure_devops_agent/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
# Azure devops agent

This module allow to create an azure devops agent (vm scale set), and inside the folder scripts has a lot of utilities

## How to use

```ts
resource "azurerm_resource_group" "azdo_rg" {
count = var.enable_azdoa ? 1 : 0
name = local.azuredevops_rg_name
location = var.location

tags = var.tags
}

module "azdoa_snet" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//subnet?ref=v3.5.2"
count = var.enable_azdoa ? 1 : 0
name = local.azuredevops_subnet_name
address_prefixes = var.cidr_subnet_azdoa
resource_group_name = azurerm_resource_group.rg_vnet.name
virtual_network_name = module.vnet.name
private_endpoint_network_policies_enabled = true
}

module "azdoa_vmss_li" {
source = "git::https://github.com/pagopa/terraform-azurerm-v3.git//azure_devops_agent?ref=azure-devops-agent-migration-v2"
count = var.enable_azdoa ? 1 : 0
name = local.azuredevops_agent_vm_name
resource_group_name = azurerm_resource_group.azdo_rg[0].name
subnet_id = module.azdoa_snet[0].id
subscription = data.azurerm_subscription.current.display_name

tags = var.tags
}

```

<!-- markdownlint-disable -->
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Requirements
Expand Down
1 change: 1 addition & 0 deletions azure_devops_agent/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ resource "null_resource" "this" {
name = var.name
resource_group_name = var.resource_group_name
subscription = var.subscription
config_json = "${sha1(file("${path.module}/script-config.json"))}"
}

provisioner "local-exec" {
Expand Down
25 changes: 23 additions & 2 deletions azure_devops_agent/script-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ apt-get -y install zip unzip
# install az cli from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt#option-2-step-by-step-installation-instructions

apt-get -y update
apt-get -y install ca-certificates curl apt-transport-https lsb-release gnupg
apt-get -y install ca-certificates curl wget apt-transport-https lsb-release gnupg

curl -sL https://packages.microsoft.com/keys/microsoft.asc |
gpg --dearmor |
Expand All @@ -35,7 +35,7 @@ echo \
$(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null

apt-get -y update
apt-get -y install docker-ce docker-ce-cli containerd.io
apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose-plugin

# install kubectl from https://kubernetes.io/docs/tasks/tools/install-kubectl-linux/#install-using-native-package-management

Expand All @@ -55,10 +55,31 @@ echo "deb https://baltocdn.com/helm/stable/debian/ all main" | tee /etc/apt/sour
apt-get -y update
apt-get -y install helm

# install yq from https://github.com/mikefarah/yq#install

YQ_VERSION="v4.27.2"
YQ_BINARY="yq_linux_amd64"
wget https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}.tar.gz -O - |\
tar xz && mv ${YQ_BINARY} /usr/bin/yq

# install zip unzip

apt-get -y update
apt-get -y install zip unzip

# install SOPS from https://github.com/mozilla/sops
SOPS_VERSION="v3.7.3"
SOPS_BINARY="3.7.3_amd64.deb"

wget https://github.com/mozilla/sops/releases/download/${SOPS_VERSION}/sops_${SOPS_BINARY} |apt install -y $PWD/sops_${SOPS_BINARY}

# install jq

apt-get -y update
apt-get -y install jq

# prepare machine for k6 large load test

sysctl -w net.ipv4.ip_local_port_range="1024 65535"
sysctl -w net.ipv4.tcp_tw_reuse=1
sysctl -w net.ipv4.tcp_timestamps=1
Expand Down

0 comments on commit 8d259f5

Please sign in to comment.