Skip to content

silhouetteUA/tf-with-gcp-statefile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

tf-with-gcp-statefile

Both - local (KIND) and remote (GCP-GKE) deployment are available here

This TF workflow creates:

  • K8S cluster: local via KIND OR GCP-GKE
  • Deploys FluxCD on K8S
  • FluxCD start reconciliation with remote gut hub repo: kbot
  • Both localhost KIND and GKE clusters maintain tfstate in remote GCP bucket

Create manifest for a git source for FluxCD:

flux create source git kbot \                                                                                                                            
> --url=https://github.com/silhouetteUA/kbot \
> --branch=main \
> --namespace=course \
> --export
---
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
  name: kbot
  namespace: course
spec:
  interval: 1m0s
  ref:
    branch: main
  url: https://github.com/silhouetteUA/kbot

Create manifest for helmrelease using object created above:

flux create helmrelease kbot \                                                                                                                                
> --namespace=course \
> --source=GitRepository/kbot \
> --chart="./helm" \
> --interval=1m \
> --export
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
  name: kbot
  namespace: course
spec:
  chart:
    spec:
      chart: ./helm
      reconcileStrategy: ChartVersion
      sourceRef:
        kind: GitRepository
        name: kbot
  interval: 1m0s

Add these two YAML files to and commit the changes in order to start Flux to reconcile the state (it will create kbot app from Helm charts): https://github.com/silhouetteUA/kbot/tree/main/cluster/fluxcd-test/demo-namespace

About

Basic TF project with state file located on GCP bucket

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages