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

Assign IP address to a VSI on provisioning ( ibm_is_instance ) #1830

Closed
rbustami opened this issue Aug 25, 2020 · 4 comments
Closed

Assign IP address to a VSI on provisioning ( ibm_is_instance ) #1830

rbustami opened this issue Aug 25, 2020 · 4 comments
Assignees

Comments

@rbustami
Copy link

rbustami commented Aug 25, 2020

Affected Resource(s)

Please list the resources as a list, for example:

  • ibm_is_instance

Terraform Configuration Files

Example of how the resouce shoudl be implemented:

resource "ibm_is_instance" "testacc_instance" {
  name    = "testinstance"
  image   = "7eb4e35b-4257-56f8-d7da-326d85452591"
  profile = "b-2x8"
  **ipv4_address = "10.240.128.4"**  <<--- Should be able to assign IP address to VSI

  primary_network_interface {
    subnet = ibm_is_subnet.testacc_subnet.id
  }

  network_interfaces {
    name   = "eth1"
    subnet = ibm_is_subnet.testacc_subnet.id
  }

  vpc  = ibm_is_vpc.testacc_vpc.id
  zone = "us-south-1"
  keys = [ibm_is_ssh_key.testacc_sshkey.id]

  //User can configure timeouts
  timeouts {
    create = "90m"
    delete = "30m"
  }
}

Expected Behavior

Assign a specific IP address to a VSI

Actual Behavior

No options to do so in Terraform. YOU CAN do this via CLI. Check CLI ibmcloud is inc options (--ipv4 value):

OPTIONS:
    --image-id value                   ID of the image.
    --boot-volume value                BOOT_VOLUME_JSON|@BOOT_VOLUME_JSON_FILE, boot volume attachment in JSON or JSON file
    --volume-attach value              VOLUME_ATTACH_JSON|@VOLUME_ATTACH_JSON_FILE, volume attachment in JSON or JSON file, list of volumes
    --key-ids value                    Comma separated IDs of SSH keys.
    --user-data value                  data|@data-file. User data to transfer to the virtual server instance
    --security-group-ids value         Comma separated security group IDs for primary network interface.
    --ipv4 value                       Primary IPv4 address for the primary network interface
    --primary-network-interface value  PRIMARY_NETWORK_INTERFACE_JSON|@PRIMARY_NETWORK_INTERFACE_JSON_FILE, primary network interface in JSON or JSON file
    --network-interface value          NETWORK_INTERFACE_JSON|@NETWORK_INTERFACE_JSON_FILE, network interface attachment in JSON or JSON file
    --resource-group-id value          ID of the resource group. This option is mutually exclusive with --resource-group-name
    --resource-group-name value        Name of the resource group. This option is mutually exclusive with --resource-group-id
    --json                             Format output in JSON
    --interactive, -i                  Supply the parameters under interactive mode, this option is mutually exclusive with all other arguments and options.
@VaishnaviGopal
Copy link
Collaborator

VaishnaviGopal commented Aug 26, 2020

Hello @rbustami Earlier the ipv4 is a computed field. Now we have changed it to optional and computed field. We are working with API team to get more information about ipv4. We will update soon.

VaishnaviGopal added a commit to VaishnaviGopal/terraform-provider-ibm that referenced this issue Aug 26, 2020
hkantare pushed a commit that referenced this issue Aug 26, 2020
@VaishnaviGopal
Copy link
Collaborator

Fixed in the latest provider release https://github.com/IBM-Cloud/terraform-provider-ibm/releases/tag/v1.11.1

@VaishnaviGopal VaishnaviGopal self-assigned this Aug 28, 2020
@VaishnaviGopal
Copy link
Collaborator

VaishnaviGopal commented Sep 23, 2020

@rbustami, The example resource for vpc instance will look like this now:

resource "ibm_is_instance" "testacc_instance" {
  name    = "testinstance"
  image   = "7eb4e35b-4257-56f8-d7da-326d85452591"
  profile = "b-2x8"
  primary_network_interface {
    subnet = ibm_is_subnet.testacc_subnet.id
    primary_ipv4_address = "10.240.128.4"
  }
  network_interfaces {
    name   = "eth1"
    subnet = ibm_is_subnet.testacc_subnet.id
  }
  vpc  = ibm_is_vpc.testacc_vpc.id
  zone = "us-south-1"
  keys = [ibm_is_ssh_key.testacc_sshkey.id]
  //User can configure timeouts
  timeouts {
    create = "90m"
    delete = "30m"
  }
}

@hkantare
Copy link
Collaborator

hkantare commented Oct 1, 2020

closing the issue based on above comments

@hkantare hkantare closed this as completed Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants