From a2c8072ce503637f35ad1b77380c1bf05dd64dd0 Mon Sep 17 00:00:00 2001 From: Luca Cavallin <14332663+lucavallin@users.noreply.github.com> Date: Tue, 5 Dec 2023 11:11:33 +0000 Subject: [PATCH] commit missed files --- .devcontainer/devcontainer.json | 1 - .github/workflows/terraform.yml | 48 ++---------------------------- README.md | 19 ++++++++++-- main.tf | 0 scripts/aws-cli.sh | 4 +++ scripts/azure-cli.sh | 2 ++ scripts/{install.sh => gcp-cli.sh} | 5 ++-- 7 files changed, 28 insertions(+), 51 deletions(-) delete mode 100644 main.tf create mode 100755 scripts/aws-cli.sh create mode 100755 scripts/azure-cli.sh rename scripts/{install.sh => gcp-cli.sh} (74%) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c35ec22..5962355 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -3,5 +3,4 @@ "features": { "ghcr.io/devcontainers/features/terraform:1": {} } - "postCreateCommand": "../scripts/install.sh" } diff --git a/.github/workflows/terraform.yml b/.github/workflows/terraform.yml index b1aa738..63575df 100644 --- a/.github/workflows/terraform.yml +++ b/.github/workflows/terraform.yml @@ -1,46 +1,3 @@ -# This workflow installs the latest version of Terraform CLI and configures the Terraform CLI configuration file -# with an API token for Terraform Cloud (app.terraform.io). On pull request events, this workflow will run -# `terraform init`, `terraform fmt`, and `terraform plan` (speculative plan via Terraform Cloud). On push events -# to the "main" branch, `terraform apply` will be executed. -# -# Documentation for `hashicorp/setup-terraform` is located here: https://github.com/hashicorp/setup-terraform -# -# To use this workflow, you will need to complete the following setup steps. -# -# 1. Create a `main.tf` file in the root of this repository with the `remote` backend and one or more resources defined. -# Example `main.tf`: -# # The configuration for the `remote` backend. -# terraform { -# backend "remote" { -# # The name of your Terraform Cloud organization. -# organization = "example-organization" -# -# # The name of the Terraform Cloud workspace to store Terraform state files in. -# workspaces { -# name = "example-workspace" -# } -# } -# } -# -# # An example resource that does nothing. -# resource "null_resource" "example" { -# triggers = { -# value = "A example resource that does nothing!" -# } -# } -# -# -# 2. Generate a Terraform Cloud user API token and store it as a GitHub secret (e.g. TF_API_TOKEN) on this repository. -# Documentation: -# - https://www.terraform.io/docs/cloud/users-teams-organizations/api-tokens.html -# - https://help.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets -# -# 3. Reference the GitHub secret in step using the `hashicorp/setup-terraform` GitHub Action. -# Example: -# - name: Setup Terraform -# uses: hashicorp/setup-terraform@v1 -# with: -# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }} name: 'Terraform' @@ -62,6 +19,7 @@ jobs: defaults: run: shell: bash + working-directory: src steps: # Checkout the repository to the GitHub Actions runner @@ -80,10 +38,10 @@ jobs: - name: Terraform Format run: terraform fmt -check - # Setup, init and run TFLint linter + # Setup, init and run TFLint linter - uses: terraform-linters/setup-tflint@v3 name: Setup TFLint - + - name: Init TFLint run: tflint --init diff --git a/README.md b/README.md index 1a6f7b6..ca7b878 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,31 @@ # tf-ghes-oidc -Terraform configuration to setup cloud resources for OIDC on GHES. +Terraform configuration to setup cloud resources for OpenID Connect (OIDC) on GitHub Enterprise Server (GHES). TODO: describe problem ## Development +install cli +terraform init +say about backend +CI/CD +tfvars +plan out / apply file + ## Setup ### Azure ### Google Cloud -gcloud init +create project on gcp, make sure billing linked to project +must run gcloud init (select project you created) +source ~/.bashrc +run gcloud auth application-default login +update tf vars + ### AWS +## Clean Up + +destroy diff --git a/main.tf b/main.tf deleted file mode 100644 index e69de29..0000000 diff --git a/scripts/aws-cli.sh b/scripts/aws-cli.sh new file mode 100755 index 0000000..9fc0de0 --- /dev/null +++ b/scripts/aws-cli.sh @@ -0,0 +1,4 @@ +# Install the AWS CLI +curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" +unzip awscliv2.zip +sudo ./aws/install diff --git a/scripts/azure-cli.sh b/scripts/azure-cli.sh new file mode 100755 index 0000000..7cd834d --- /dev/null +++ b/scripts/azure-cli.sh @@ -0,0 +1,2 @@ +# Install the Azure CLI +curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash diff --git a/scripts/install.sh b/scripts/gcp-cli.sh similarity index 74% rename from scripts/install.sh rename to scripts/gcp-cli.sh index b82253a..e48a3b0 100755 --- a/scripts/install.sh +++ b/scripts/gcp-cli.sh @@ -1,6 +1,5 @@ -# Install Google Cloud CLI - +# Install the Google Cloud CLI curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-455.0.0-linux-x86_64.tar.gz tar -xf google-cloud-cli-455.0.0-linux-x86_64.tar.gz ./google-cloud-sdk/install.sh - +./google-cloud-sdk/bin/gcloud init