Skip to content

Commit

Permalink
upload terraform output to gist
Browse files Browse the repository at this point in the history
  • Loading branch information
liyangau committed Apr 20, 2024
1 parent 5ebed58 commit 14f0aac
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 20 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/apply.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,32 @@ jobs:
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Terraform Apply
id: apply
if: github.event_name == 'push'
run: terraform apply -auto-approve -input=false
- name: Generate terraform output
id: output
run: terraform output -no-color -json > ./konnectTFOutput.json
continue-on-error: false
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_ENDPOINT_URL_S3: ${{ secrets.AWS_ENDPOINT_URL_S3 }}
AWS_EC2_METADATA_DISABLED: true
TF_VAR_system_token: ${{ secrets.KONNECT_SYSTEM_TOKEN }}
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: "true"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: tf-output
path: ./konnectTFOutput.json

update-tf-output-gist:
needs: apply-changes
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: tf-output
- name: Upload to Gist
uses: exuanbo/[email protected]
with:
token: ${{ secrets.GH_GIST_TOKEN }}
gist_id: ${{ secrets.GIST_ID }}
file_path: ./konnectTFOutput.json
14 changes: 7 additions & 7 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,20 @@ provider "konnect" {
}

module "control-planes" {
source = "./modules/control-planes"
source = "./modules/control-planes"
exclude_mesh_control_plane = var.exclude_mesh_control_plane
}

module "gateway-configs" {
source = "./modules/gateway-configs"
control_plane_dev = module.control-planes.dev
gateway_services_echo = module.gateway-configs.gateway_services_echo
source = "./modules/gateway-configs"
control_plane_dev = module.control-planes.dev
gateway_services_echo = module.gateway-configs.gateway_services_echo
gateway_services_httpbin = module.gateway-configs.gateway_services_httpbin
}

module "dev-portal" {
source = "./modules/dev-portal"
control_plane_dev = module.control-planes.dev
gateway_services_echo = module.gateway-configs.gateway_services_echo
source = "./modules/dev-portal"
control_plane_dev = module.control-planes.dev
gateway_services_echo = module.gateway-configs.gateway_services_echo
gateway_services_httpbin = module.gateway-configs.gateway_services_httpbin
}
23 changes: 17 additions & 6 deletions output.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
output "dev_config" {
value = module.control-planes.dev.config
}
# output "dev_config" {
# value = module.control-planes.dev.config
# }

output "home_cluster_config" {
value = module.control-planes.home_cluster.config
}
# output "home_cluster_config" {
# value = module.control-planes.home_cluster.config
# }

output "portal_domain" {
value = module.dev-portal.portal.default_domain
}

output "gateway_cps_endpoints" {
value = [
{
dev = module.control-planes.dev.config
},
{
home_cluster = module.control-planes.home_cluster.config
}
]
}

0 comments on commit 14f0aac

Please sign in to comment.