Skip to content

Commit

Permalink
move to tofu
Browse files Browse the repository at this point in the history
  • Loading branch information
vivian-rook committed Mar 11, 2024
1 parent 214136c commit aac9729
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
10 changes: 5 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ if ! command -v helm ; then
exit 1
fi

if ! command -v terraform ; then
echo "please install terraform"
if ! command -v tofu; then
echo "please install tofu"
exit 1
fi

python3 -m venv .venv/deploy
source .venv/deploy/bin/activate
pip install ansible==8.1.0 kubernetes==26.1.0

cd terraform
terraform init
terraform apply # -auto-approve
cd tofu
tofu init
tofu apply # -auto-approve
export KUBECONFIG=$(pwd)/kube.config

cd ../ansible
Expand Down
Binary file removed terraform/secrets.tf
Binary file not shown.
14 changes: 7 additions & 7 deletions terraform/123.tf → tofu/123.tf
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
resource "openstack_containerinfra_cluster_v1" "k8s_123_1" {
name = "quarry-123-1"
cluster_template_id = resource.openstack_containerinfra_clustertemplate_v1.template_123_1.id
resource "openstack_containerinfra_cluster_v1" "k8s_123_2" {
name = "quarry-123-2"
cluster_template_id = resource.openstack_containerinfra_clustertemplate_v1.template_123_2.id
master_count = 1
node_count = 2
}

resource "local_file" "kube_config" {
content = resource.openstack_containerinfra_cluster_v1.k8s_123_1.kubeconfig.raw_config
content = resource.openstack_containerinfra_cluster_v1.k8s_123_2.kubeconfig.raw_config
filename = "kube.config"
}

resource "openstack_containerinfra_clustertemplate_v1" "template_123_1" {
name = "quarry-123-1"
resource "openstack_containerinfra_clustertemplate_v1" "template_123_2" {
name = "quarry-123-2"
coe = "kubernetes"
dns_nameserver = "8.8.8.8"
docker_storage_driver = "overlay2"
Expand All @@ -21,7 +21,7 @@ resource "openstack_containerinfra_clustertemplate_v1" "template_123_1" {
fixed_network = "lan-flat-cloudinstances2b"
flavor = "g3.cores4.ram8.disk20"
floating_ip_enabled = "false"
image = "magnum-fedora-coreos-34"
image = "magnum-fedora-coreos-38"
master_flavor = "g3.cores2.ram4.disk20"
network_driver = "flannel"

Expand Down
File renamed without changes.
File renamed without changes.
9 changes: 9 additions & 0 deletions tofu/secrets.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
variable "application_credential_secret" {
type = string
default = "ThRJlLtw2RAKoVAr0rrWryUNMMgplt03ocHcEmgL7KWBS1UAJBLutR2jlfUn5Tt-sIue5yT0phjah9iGNDuv0w"
}

variable "db_password" {
type = string
default = "18SKxfnijNttvZ8tyaPvCzL3s"
}
File renamed without changes.

0 comments on commit aac9729

Please sign in to comment.