SUSE / ha-sap-terraform-deployments

Automated SAP/HA Deployments in Public/Private Clouds
GNU General Public License v3.0
122 stars 88 forks source link

Bastion enabled got error - GCP Deployment #840

Closed busetde closed 2 years ago

busetde commented 2 years ago

Hi,

GCP deployment, when bastion_enabled = true there will be error like below:

╷
│ Error: Invalid index
│ 
│   on infrastructure.tf line 120, in resource "google_compute_router_nat" "nat":
│  120:     name                    = google_compute_subnetwork.ha_subnet.*.self_link[0]
│     ├────────────────
│     │ google_compute_subnetwork.ha_subnet is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.
╵
budi@slestf:~/ha-sap-terraform-deployments/gcp> sudo vi terraform.tfvars
budi@slestf:~/ha-sap-terraform-deployments/gcp> terraform apply --auto-approve
╷
│ Error: Invalid index
│ 
│   on infrastructure.tf line 120, in resource "google_compute_router_nat" "nat":
│  120:     name                    = google_compute_subnetwork.ha_subnet.*.self_link[0]
│     ├────────────────
│     │ google_compute_subnetwork.ha_subnet is empty tuple
│ 
│ The given key does not identify an element in this collection value: the collection has no elements.

Please kindly advise

yeoldegrove commented 2 years ago

@busetde I was just able to deploy a setup with the latest 8.0.3 release. Please compare your terraform.tfvars with the latest terraform.tfvars.example and give feedback in case we shall reopen this.

busetde commented 2 years ago

@yeoldegrove - apologize to open this again Clone the latest master branch and already compare my terraform.tfvars with terraform.tfvars.example and still experience the same below, any advise please.

image

yeoldegrove commented 2 years ago

@busetde Could you send over a redacted terraform.tfvars?

busetde commented 2 years ago

@yeoldegrove - Please find attached terraform.tfvars

yeoldegrove commented 2 years ago

@busetde I see that you define these 3 variables

vpc_name = "slesnetwork"
subnet_name = "sles-asia-southeast2"
ip_cidr_range = "10.0.0.0/24"

You mustn't use vpc_name / subnet_name and ip_cidr_range at the same time... from terraform.tfvars.example ...

# Use an already existing vpc
#vpc_name = "my-vpc"

# Use an already existing subnet in this virtual network
#subnet_name = "my-subnet"

# vpc address range in CIDR notation
# Only used if the vpc is created by terraform or the user doesn't have read permissions in this
# resource. To use the current vpc address range set the value to an empty string
# To define custom ranges
#ip_cidr_range = "10.0.0.0/24"

So use vpc/subnet if you want to use an existing subnet or use ip_cidr_range if you want to create those with terraform. You can customize the network nam portions via the deployment_name variable (you do not set this so far).

In addition to that you actually found a bug :+1:

After you adapted your terraform.tfvars again for an existing or non-existing network use case, please have a look if this fixes your deployment: https://github.com/SUSE/ha-sap-terraform-deployments/pull/858

yeoldegrove commented 2 years ago

Should be fixed in https://github.com/SUSE/ha-sap-terraform-deployments/releases/tag/8.1.2 Waiting for confirmation from @busetde

busetde commented 2 years ago

@yeoldegrove - confirmed it's fixed now after comment out the vpc_name.

busetde commented 2 years ago

@yeoldegrove - apologize to put another bug here But when try to do terraform apply Below error comes: module.netweaver_node.module.netweaver_provision.null_resource.provision[1] (remote-exec): local: module.netweaver_node.module.netweaver_provision.null_resource.provision[1] (remote-exec): Data failed to compile: module.netweaver_node.module.netweaver_provision.null_resource.provision[1] (remote-exec): ---------- module.netweaver_node.module.netweaver_provision.null_resource.provision[1] (remote-exec): Specified SLS cluster.cloud_detection in saltenv predeployment is not available on the salt master or through a configured fileserver module.netweaver_node.module.netweaver_provision.null_resource.provision[1] (remote-exec): Wed May 25 13:22:29 UTC 2022::default-vmnetweaver02::[ERROR] predeployment failed

Any advise?

yeoldegrove commented 2 years ago

closing this as it is resolved. Related issue will be tracked in #859