tetratelabs / tetrate-service-bridge-sandbox

Deploy Tetrate Service Bridge Demo on Azure Kubernetes Service (AKS), Google Kubernetes Engine (GKE) and/or Elastic Kubernetes Service (EKS) using Terraform
Apache License 2.0
12 stars 10 forks source link

[BUG] When "tsb_org" value is different than "tetrate" CP onboarding fails due to script hardcoded value #273

Closed nauticalmike closed 1 year ago

nauticalmike commented 1 year ago

Describe the bug When "tsb_org" value is different than "tetrate" CP onboarding fails due to script that creates AB has the hardcoded value.

To Reproduce Try to provision a cp with a name different than "tetrate" should get the following errors:

Plan: 5 to add, 0 to change, 1 to destroy.
module.tsb_cp.null_resource.jumpbox_tctl: Destroying... [id=2669047930515330663]
module.tsb_cp.null_resource.jumpbox_tctl: Destruction complete after 0s
module.tsb_cp.null_resource.jumpbox_tctl: Creating...
module.tsb_cp.null_resource.jumpbox_tctl: Provisioning with 'file'...
module.tsb_cp.null_resource.jumpbox_tctl: Provisioning with 'file'...
module.tsb_cp.null_resource.jumpbox_tctl: Provisioning with 'remote-exec'...
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): Connecting to remote host via SSH...
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Host: 74.249.162.251
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   User: tsbadmin
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Password: false
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Private key: true
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Certificate: false
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   SSH Agent: false
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Checking Host Key: false
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):   Target Platform: unix
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): Connected!
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): organizations/sephora/clusters/aks-nm-c4a-centralus-0 unchanged
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): Error: get failed: 1 error occurred:
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):         * node not found

module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): Creating RBAC policy and adding aks-nm-c4a-centralus-0...
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec): Error: apply failed: 1 error occurred:
module.tsb_cp.null_resource.jumpbox_tctl (remote-exec):         * rbac.tsb.tetrate.io/v2/AccessBindings/: error setting policy: error assigning "organizations/tetrate/serviceaccounts/cluster-aks-nm-c4a-centralus-0" to UA(owner:organizations/tetrate/serviceaccounts/cluster-aks-nm-c4a-centralus-0): error retrieving child node "users:organizations/tetrate/serviceaccounts/cluster-aks-nm-c4a-centralus-0": node not **found**
╷
│ Error: remote-exec provisioner error
│ 
│   with module.tsb_cp.null_resource.jumpbox_tctl,
│   on ../../modules/tsb/cp/main.tf line 51, in resource "null_resource" "jumpbox_tctl":
│   51:   provisioner "remote-exec" {
│ 
│ error executing "/tmp/terraform_538903875.sh": Process exited with status 1

Due to this file

Expected behavior Org name needs to be parametrized and passed to the script for the ab.

terraform.tfvars.json

{
    "name_prefix": "nm-c4a",
    "tsb_fqdn": "nm-c4a.azure.sandbox.tetrate.io",
    "tsb_version": "1.6.1",
    "tsb_image_sync_username": "nauticalmike",
    "tsb_image_sync_apikey": "1b6830be641140dafd44a282020802bede0a5e50",
    "tsb_password": "Tetrate123",
    "tsb_mp": {
        "cloud": "azure",
        "cluster_id": 0
    },
    "tsb_org": "sephora",
    "aws_k8s_regions": [],
    "azure_k8s_regions": [
        "centralus",
        "eastus",
        "westus"
    ],
    "gcp_k8s_regions": [],
    "tetrate_owner": "michael",
    "tetrate_team": "sales:ce"
}

Versions

tf version
Terraform v1.3.6
on darwin_arm64

Additional context NA