Skip to content

Commit

Permalink
[PLAT-13813]Support image bundle creation in provider request
Browse files Browse the repository at this point in the history
Summary:
Add image bundle as a separate block in resource_cloud_provider

Add arch and image_bundle_uuid to resource_universe

Test Plan:
GCP image bundle example:
```
image_bundles {
    name           = "YBA-Managed-AlmaLinux-8.9"
    use_as_default = false
    details {
      arch            = "x86_64"
      global_yb_image = "https://www.googleapis.com/compute/beta/projects/almalinux-cloud/global/images/almalinux-8-v20240213"
      ssh_user        = "centos"
      ssh_port        = 22
      use_imds_v2     = false
    }
  }
image_bundles {
    name           = "for_provider_dkumar"
    use_as_default = true
    details {
      arch            = "x86_64"
      global_yb_image = "https://www.googleapis.com/compute/beta/projects/almalinux-cloud/global/images/almalinux-8-v20220719"
      ssh_user        = "centos"
      ssh_port        = 22
      use_imds_v2     = false
    }
  }
```

AWS image bundle example:
```
image_bundles {
    name           = "YBA-Managed-AlmaLinux-8.9"
    use_as_default = false
    details {
      arch = "x86_64"
      region_overrides = {
        "us-west-2" = "ami-03f03db0b24a9f0b6"
      }
      ssh_user    = "ec2-user"
      ssh_port    = 22
      use_imds_v2 = false
    }
  }
image_bundles {
    name           = "for_provider_dkumar"
    use_as_default = true
    details {
      arch = "x86_64"
      region_overrides = {
        "us-west-2" = "ami-0f12219b4df721aa6"
      }
      ssh_user    = "ec2-user"
      ssh_port    = 22
      use_imds_v2 = false
    }
  }
```

Reviewers: svarshney, sneelakantan

Reviewed By: svarshney

Subscribers: yugaware

Differential Revision: https://phorge.dev.yugabyte.com/D35192
  • Loading branch information
Deepti-yb committed May 31, 2024
1 parent ef8c2cd commit 9bcdefb
Show file tree
Hide file tree
Showing 11 changed files with 543 additions and 42 deletions.
165 changes: 148 additions & 17 deletions docs/resources/cloud_provider.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource "yba_cloud_provider" "cloud_provider" {
code = "<region-code>"
name = "<region-name>"
}
ssh_port = 22
air_gap_install = false
}
Expand Down Expand Up @@ -71,8 +70,6 @@ resource "yba_cloud_provider" "aws_cloud_provider" {
subnet = "<subnet-id>"
}
}
ssh_port = 22
air_gap_install = false
}
Expand All @@ -93,8 +90,6 @@ resource "yba_cloud_provider" "aws_iam_cloud_provider" {
subnet = "<subnet-id>"
}
}
ssh_port = 22
air_gap_install = false
}
Expand Down Expand Up @@ -128,18 +123,36 @@ resource "yba_cloud_provider" "azure_cloud_provider" {
subnet = "<azure-subnet-id>"
}
}
ssh_port = 22
air_gap_install = false
}
resource "yba_cloud_provider" "gcp_cloud_provider" {
code = "gcp"
dest_vpc_id = "<destination-vpc-id/network>"
name = "gcp-provider"
code = "gcp"
name = "gcp-provider"
gcp_config_settings {
network = "<gcp-network>"
use_host_vpc = false
project_id = "<gcp-project-id>"
application_credentials = {
// GCP Service Account credentials JSON as map of strings
}
}
regions {
code = "us-west1"
name = "us-west1"
zones {
subnet = "<gcp-shared-subnet-id>"
}
}
air_gap_install = false
}
resource "yba_cloud_provider" "gcp_cloud_provider_with_image_bundles" {
code = "gcp"
name = "gcp-provider"
gcp_config_settings {
network = "<gcp-network>"
use_host_vpc = true
use_host_vpc = false
project_id = "<gcp-project-id>"
application_credentials = {
// GCP Service Account credentials JSON as map of strings
Expand All @@ -152,7 +165,80 @@ resource "yba_cloud_provider" "gcp_cloud_provider" {
subnet = "<gcp-shared-subnet-id>"
}
}
ssh_port = 22
image_bundles {
name = "<gcp-image-bundle-name-1>"
use_as_default = false
details {
arch = "x86_64"
global_yb_image = "<ami-id>"
ssh_user = "centos"
ssh_port = 22
use_imds_v2 = false
}
}
image_bundles {
name = "<gcp-image-bundle-name-2>"
use_as_default = true
details {
arch = "x86_64"
global_yb_image = "<ami-id>"
ssh_user = "centos"
ssh_port = 22
use_imds_v2 = false
}
}
air_gap_install = false
}
resource "yba_cloud_provider" "aws_cloud_provider_image_bundles" {
code = "aws"
name = "aws-provider"
aws_config_settings {
access_key_id = "<s3-access-key-id>"
secret_access_key = "<s3-secret-access-key>"
}
regions {
code = "us-west-2"
name = "us-west-2"
security_group_id = "<aws-sg-id>"
vnet_name = "<aws-vpc-id>"
zones {
code = "us-west-2a"
name = "us-west-2a"
subnet = "<subnet-id>"
}
zones {
code = "us-west-2b"
name = "us-west-2b"
subnet = "<subnet-id>"
}
}
image_bundles {
name = "<image-bundle-name-1>"
use_as_default = false
details {
arch = "x86_64"
region_overrides = {
"us-west-2" = "<ami-id>"
}
ssh_user = "ec2-user"
ssh_port = 22
use_imds_v2 = false
}
}
image_bundles {
name = "<image-bundle-name-2>"
use_as_default = true
details {
arch = "x86_64"
region_overrides = {
"us-west-2" = "<ami-id>"
}
ssh_user = "ec2-user"
ssh_port = 22
use_imds_v2 = false
}
}
air_gap_install = false
}
```
Expand All @@ -178,10 +264,11 @@ The details for configuration are available in the [YugabyteDB Anywhere Configur
- `gcp_config_settings` (Block List, Max: 1) Settings that can be configured for GCP. (see [below for nested schema](#nestedblock--gcp_config_settings))
- `host_vpc_id` (String, Deprecated) Host VPC Network. Deprecated since YugabyteDB Anywhere 2.17.2.0. Will be removed in the next terraform-provider-yba release.
- `host_vpc_region` (String, Deprecated) Host VPC Region. Deprecated since YugabyteDB Anywhere 2.17.2.0.Will be removed in the next terraform-provider-yba release.
- `image_bundles` (Block List) Image bundles associated with cloud providers. Supported from YugabyteDB Anywhere version: 2.20.3.0-b68 (see [below for nested schema](#nestedblock--image_bundles))
- `key_pair_name` (String) Access Key Pair name.
- `ssh_port` (Number) Port to use for ssh commands.
- `ssh_port` (Number, Deprecated) Port to use for ssh commands. Deprecated since YugabyteDB Anywhere 2.20.3.0. Please use 'image_bundles[*].details.ssh_port' instead.
- `ssh_private_key_content` (String) Private key to use for ssh commands.
- `ssh_user` (String) User to use for ssh commands.
- `ssh_user` (String, Deprecated) User to use for ssh commands. Deprecated since YugabyteDB Anywhere 2.20.3.0. Please use 'image_bundles[*].details.ssh_user' instead.
- `timeouts` (Block, Optional) (see [below for nested schema](#nestedblock--timeouts))

### Read-Only
Expand All @@ -195,18 +282,18 @@ The details for configuration are available in the [YugabyteDB Anywhere Configur
Optional:

- `code` (String) Region code. Varies by cloud provider.
- `config` (Map of String) Config details corresponding to region.
- `instance_template` (String) Instance template to be used in this region. Only set for GCP provider. Allowed in YugabyteDB Anywhere versions above 2.18.0.0-b65.
- `latitude` (Number) Latitude of the region.
- `longitude` (Number) Longitude of the region.
- `name` (String) Name of the region. Varies by cloud provider.
- `security_group_id` (String) Security group ID to use for this region. Only set for AWS/Azure providers.
- `vnet_name` (String) Name of the virtual network/VPC ID to use for this region. Only set for AWS/Azure providers.
- `yb_image` (String) AMI to be used in this region.
- `yb_image` (String, Deprecated) AMI to be used in this region. Deprecated since YugabyteDB Anywhere 2.20.3.0. Please use image_bundles block instead.
- `zones` (Block List) Zones associated with the region. (see [below for nested schema](#nestedblock--regions--zones))

Read-Only:

- `config` (Map of String) Config details corresponding to region.
- `uuid` (String) Region UUID.

<a id="nestedblock--regions--zones"></a>
Expand All @@ -215,14 +302,14 @@ Read-Only:
Optional:

- `code` (String) Code of the zone. Varies by cloud provider.
- `config` (Map of String) Configuration details corresponding to zone.
- `name` (String) Name of the zone. Varies by cloud provider.
- `secondary_subnet` (String) The secondary subnet in the AZ.
- `subnet` (String) Subnet to use for this zone.

Read-Only:

- `active` (Boolean) Flag indicating if the zone is active.
- `config` (Map of String) Configuration details corresponding to zone.
- `kube_config_path` (String) Path to Kubernetes configuration file.
- `uuid` (String) Zone UUID.

Expand Down Expand Up @@ -269,6 +356,50 @@ Optional:
- `yb_firewall_tags` (String) Tags for firewall rules in GCP.


<a id="nestedblock--image_bundles"></a>
### Nested Schema for `image_bundles`

Required:

- `details` (Block List, Min: 1, Max: 1) (see [below for nested schema](#nestedblock--image_bundles--details))
- `name` (String) Name of the image bundle.

Optional:

- `use_as_default` (Boolean) Flag indicating if the image bundle should be used as default for this archietecture.

Read-Only:

- `active` (Boolean) Is the image bundle active.
- `metadata` (List of Object) (see [below for nested schema](#nestedatt--image_bundles--metadata))
- `uuid` (String) Image bundle UUID.

<a id="nestedblock--image_bundles--details"></a>
### Nested Schema for `image_bundles.details`

Required:

- `arch` (String) Image bundle architecture.
- `ssh_user` (String) SSH user for the image.

Optional:

- `global_yb_image` (String) Global YB image for the bundle.
- `region_overrides` (Map of String) Region overrides for the bundle. Provide region code as the key and override image as the value.
- `ssh_port` (Number) SSH port for the image. Default is 22.
- `use_imds_v2` (Boolean) Use IMDS v2 for the image.


<a id="nestedatt--image_bundles--metadata"></a>
### Nested Schema for `image_bundles.metadata`

Read-Only:

- `type` (String)
- `version` (String)



<a id="nestedblock--timeouts"></a>
### Nested Schema for `timeouts`

Expand Down
2 changes: 2 additions & 0 deletions docs/resources/universe.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The following operations are supported in the Edit universe workflow:

### Optional

- `arch` (String) The architecture of the universe nodes. Allowed values are x86_64 and aarch64.
- `client_root_ca` (String) The UUID of the clientRootCA to be used to generate client certificates and facilitate TLS communication between server and client.
- `communication_ports` (Block List, Max: 1) Communication ports. (see [below for nested schema](#nestedblock--communication_ports))
- `delete_options` (Block List, Max: 1) (see [below for nested schema](#nestedblock--delete_options))
Expand Down Expand Up @@ -123,6 +124,7 @@ Optional:
- `enable_yedis` (Boolean) Enable YEDIS. False by default.
- `enable_ysql` (Boolean) Enable YSQL. True by default.
- `enable_ysql_auth` (Boolean) Enable YSQL authentication.
- `image_bundle_uuid` (String) Image Bundle UUID.
- `instance_tags` (Map of String) Instance Tags.
- `master_gflags` (Map of String) Set of Master GFlags.
- `preferred_region` (String) Preferred Region for node placement.
Expand Down
Loading

0 comments on commit 9bcdefb

Please sign in to comment.