Skip to content

Instantly share code, notes, and snippets.

View GTRekter's full-sized avatar
🌎
안녕하세요

Ivan (이반) Porta GTRekter

🌎
안녕하세요
View GitHub Profile
@GTRekter
GTRekter / log.txt
Created June 24, 2023 11:45
terraform plan -generate-config-out fail log
This file has been truncated, but you can view the full file.
2023-06-24T12:36:09.949+0100 [INFO] Terraform version: 1.5.1
2023-06-24T12:36:09.949+0100 [DEBUG] using github.com/hashicorp/go-tfe v1.26.0
2023-06-24T12:36:09.949+0100 [DEBUG] using github.com/hashicorp/hcl/v2 v2.16.2
2023-06-24T12:36:09.949+0100 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.0
2023-06-24T12:36:09.949+0100 [DEBUG] using github.com/zclconf/go-cty v1.12.2
2023-06-24T12:36:09.949+0100 [INFO] Go runtime version: go1.20.5
2023-06-24T12:36:09.949+0100 [INFO] CLI args: []string{"/snap/terraform/517/terraform", "plan", "-generate-config-out", "new.tf"}
2023-06-24T12:36:09.949+0100 [TRACE] Stdout is not a terminal
2023-06-24T12:36:09.949+0100 [TRACE] Stderr is not a terminal
2023-06-24T12:36:09.949+0100 [TRACE] Stdin is a terminal
@GTRekter
GTRekter / setup.sh
Created May 20, 2023 10:59
This script automates NordVPN connection to different countries and performs nslookup for a specified endpoint. It checks if NordVPN is installed and logged in, prompts for installation if needed, and asks for the endpoint for nslookup.
#!/bin/bash
# Check if NordVPN is installed
if ! command -v nordvpn &> /dev/null; then
echo "NordVPN is not installed. Installing..."
# Determine the installation command based on the system
if command -v apt-get &> /dev/null; then
sudo apt-get install nordvpn
elif command -v yum &> /dev/null; then
sudo yum install nordvpn
@GTRekter
GTRekter / setup.sh
Created April 15, 2023 08:03
This script configures organization settings in Azure DevOps using cURL commands. It sets various policies for an organization such as disabling anonymous access badges, limiting variables set at queue time, and limiting job authorization scope to the current project for non-release pipelines.
PAT=""
ORG_NAME=""
DEFAULT_JSON='{
"organization": {
"settings": {
"disable_anonymous_access_badges": true,
"limit_variables_set_queue_time": false,
"limit_job_authorization_current_project_non_release_pipelines": false,
"limit_job_authorization_current_project_release_pipelines": false,
"protect_access_repositories_yaml_pipelines": false,
@GTRekter
GTRekter / setup.sh
Created April 15, 2023 06:58
This is a bash script that configures several organization policies for a specified Azure DevOps organization. The script makes use of the Azure DevOps REST API to perform PATCH requests on the different policies. The policies that are being configured include disallowing third-party application access via OAuth, disallowing SSH authentication, …
PAT=""
ORG_NAME=""
DEFAULT_JSON={
"organization": {
"policies": {
"disallow_third_party_application_access_via_oauth": false,
"disallow_ssh_authentication": false,
"log_audit_events": true,
"allow_public_projects": true,
"additional_protections_public_package_registries": true,
@GTRekter
GTRekter / setup.sh
Last active April 14, 2023 07:01
This script checks if an Azure Active Directory is already connected to an organization in Azure DevOps. If it is, it skips the connection process. If it is not, it connects the organization to the Azure Active Directory.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"organization": {
"name": "portaivan",
"azure_active_directory": {
"tenant_id": "xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
@GTRekter
GTRekter / setup.sh
Created April 13, 2023 14:45
The script is designed to automate the creation of Azure DevOps agent pools. It will process both self-hosted and Azure-hosted pools.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"agent_pools":
[
{
"self_hosted":[
{
"name": "Default",
@GTRekter
GTRekter / setup.sh
Last active April 13, 2023 06:19
The script is designed to automate the process of creating an Azure Resource Manager (Azurerm) and GitHub service connection. The script first checks if the service connections already exist, and if they do not, it creates them.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"pipeline": {
"service_endpoints": [
{
"azurerm": [
{
"name": "Azure",
@GTRekter
GTRekter / setup.sh
Last active April 13, 2023 14:38
The script is designed to automate the assignment of security groups to environments.
PAT=""
ORG_NAME="ivanporta"
PROJECT_NAME="Sample"
DEFAULT_JSON='{
"pipeline": {
"environments": [
{
"name": "Connectivity",
"description": "Connectivity production environment",
"security_groups_name": [
@GTRekter
GTRekter / AzDO-Terraform-Plan-PR.yaml
Last active January 23, 2024 14:11
This snippet contains the steps to generate a terraform plan and post it as a comment of a pull request in Azure DevOps
- script: |
terraform plan -out tf.tfplan
displayName: Generate Terraform plan
- script: |
terraform show -no-color tf.tfplan > $(Agent.TempDirectory)/tf.txt
displayName: Convert Terraform plan to text
- bash: |
cd $(Agent.TempDirectory)
Param(
[Parameter(Position=0)]
[string]$Office365Username,
[Parameter(Position=1)]
[string]$Office365Password,
[Parameter(Position=2)]
[string]$TeamsFilePath
)
Write-Verbose "Importing modules"