Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying multiple instances to the same azure resource group fails as resource names are not unique #741

Open
yeoldegrove opened this issue Aug 16, 2021 · 0 comments
Labels
bug Something isn't working design

Comments

@yeoldegrove
Copy link
Collaborator

Used cloud platform
Azure

Used SLES4SAP version
SLES15SP2

Used client machine OS
Linux

Expected behaviour vs observed behaviour
Deploying multiple instances of this project to the same azure resource group fails as resource names are not unique.

Making the resource names unique by adding ${var.deployment_name} would fix this.

Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/net01/subnets/snet-bastion" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_subnet" for more information.

  on modules/bastion/main.tf line 7, in resource "azurerm_subnet" "bastion":
   7: resource "azurerm_subnet" "bastion" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg-bastion" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_security_group" for more information.

  on modules/bastion/main.tf line 15, in resource "azurerm_network_security_group" "bastion":
  15: resource "azurerm_network_security_group" "bastion" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/publicIPAddresses/pip-bastion" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_public_ip" for more information.

  on modules/bastion/main.tf line 86, in resource "azurerm_public_ip" "bastion":
  86: resource "azurerm_public_ip" "bastion" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Compute/availabilitySets/avset-hana" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_availability_set" for more information.

  on modules/hana_node/main.tf line 24, in resource "azurerm_availability_set" "hana-availability-set":
  24: resource "azurerm_availability_set" "hana-availability-set" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/loadBalancers/lb-hana" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_lb" for more information.

  on modules/hana_node/main.tf line 39, in resource "azurerm_lb" "hana-load-balancer":
  39: resource "azurerm_lb" "hana-load-balancer" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic-hana01" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_interface" for more information.

  on modules/hana_node/main.tf line 155, in resource "azurerm_network_interface" "hana":
 155: resource "azurerm_network_interface" "hana" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic-hana02" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_interface" for more information.

  on modules/hana_node/main.tf line 155, in resource "azurerm_network_interface" "hana":
 155: resource "azurerm_network_interface" "hana" {



Error: A resource with the ID "/subscriptions/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/resourceGroups/rg1/providers/Microsoft.Network/networkInterfaces/nic-iscsisrv01" already exists - to be managed via Terraform this resource needs to be imported into the State. Please see the resource documentation for "azurerm_network_interface" for more information.

  on modules/iscsi_server/main.tf line 8, in resource "azurerm_network_interface" "iscsisrv":
   8: resource "azurerm_network_interface" "iscsisrv" {

How to reproduce
Specify the step by step process to reproduce the issue. This usually would look like something like this:

  1. Move to any of the cloud providers folder
  2. Create the terraform.tfvars file based on terraform.tfvars.example
  3. Run the next terraform commands:
terraform workspace new test1
terraform init
terraform plan
terraform apply -auto-approve

terraform workspace new test2
terraform init
terraform plan
terraform apply -auto-approve
@yeoldegrove yeoldegrove added the bug Something isn't working label Aug 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working design
1 participant