Cloud Accounts
Onboarding cloud accounts is the first step in using ImageFactory. You can manage these connections using Terraform resources for each supported cloud provider.
Before onboarding, ensure you have completed the necessary Cloud Onboarding steps to prepare your cloud environment.
AWS Account
Manage standard AWS accounts using the imagefactory_aws_account resource.
resource "imagefactory_aws_account" "main" {
alias = "production-aws"
description = "Account to distribute AWS images"
account_id = "123456789012"
access {
role_arn = "arn:aws:iam::123456789012:role/ImageFactoryMasterRole"
role_external_id = "lieGhohY6ahv2aijieZ9"
}
properties {
aws_share_accounts = ["234567890123"]
aws_share_organizations = ["o-exampleorgid"]
}
}
Argument Reference
| Argument | Type | Required | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the account. |
account_id | String | Required | The 12-digit AWS account ID. |
access | Block | Required | Authentication details (see below). |
description | String | Optional | A description of the account. |
properties | Block | Optional | Image sharing settings (see below). |
access block:
| Argument | Type | Description |
|---|---|---|
role_arn | String | Required. ARN of the IAM role ImageFactory should assume. |
role_external_id | String | Required. External ID for the IAM role. |
properties block:
| Argument | Type | Description |
|---|---|---|
aws_share_accounts | List of String | AWS account IDs to share images with. |
aws_share_organizations | List of String | AWS Organization IDs to share images with. |
aws_share_ous | List of String | AWS Organizational Unit IDs to share images with. |
Import
terraform import imagefactory_aws_account.main <ACCOUNT_ID>
AWS China Account
For AWS regions in China, use the imagefactory_aws_china_account resource.
resource "imagefactory_aws_china_account" "china" {
alias = "china-aws"
description = "Account to distribute AWS China images"
account_id = "987654321098"
access {
aws_access_key_id = "AKIA..."
aws_secret_access_key = "SECRET..."
}
properties {
s3_bucket_name = "my-imagefactory-bucket"
region = "cn-north-1"
aws_share_accounts = ["234567890123"]
}
}
Argument Reference
| Argument | Type | Required | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the account. |
account_id | String | Required | The AWS account ID. |
access | Block | Required | Credentials (see below). |
properties | Block | Required | Region and storage settings (see below). |
description | String | Optional | A description of the account. |
access block:
| Argument | Type | Description |
|---|---|---|
aws_access_key_id | String | Required. AWS access key ID. |
aws_secret_access_key | String | Required. AWS secret access key. |
properties block:
| Argument | Type | Description |
|---|---|---|
region | String | Required. Target AWS China region. |
s3_bucket_name | String | Required. S3 bucket name for build artifacts. |
aws_share_accounts | List of String | Optional. AWS account IDs to share images with. |
Import
terraform import imagefactory_aws_china_account.china <ACCOUNT_ID>
Azure Subscription
Manage Azure subscriptions using the imagefactory_azure_subscription resource.
resource "imagefactory_azure_subscription" "main" {
alias = "production-azure"
subscription_id = "00000000-0000-0000-0000-000000000000"
access {
tenant_id = "00000000-0000-0000-0000-000000000000"
app_id = "00000000-0000-0000-0000-000000000000"
password = "client-secret"
resource_group_name = "imagefactory-rg"
storage_account = "ifstorage"
storage_account_key = "storage-key"
shared_image_gallery = "my_gallery"
}
}
Argument Reference
| Argument | Type | Required/Optional | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the subscription. |
subscription_id | String | Required | The Azure subscription ID. |
access | Block | Required | Authentication details. |
access.tenant_id | String | Required | Azure AD Tenant ID. |
access.app_id | String | Required | Service Principal Application ID. |
access.password | String | Required | Service Principal Client Secret. |
access.resource_group_name | String | Required | Resource group for build resources. |
access.storage_account | String | Required | Storage account for build artifacts. |
access.storage_account_key | String | Required | Access key for the storage account. |
access.shared_image_gallery | String | Required | Name of the Azure Compute Gallery. |
Import
terraform import imagefactory_azure_subscription.main <SUBSCRIPTION_ID>
Azure China Subscription
For Azure China regions, use the imagefactory_azure_china_subscription resource. It uses the same schema as the standard Azure subscription resource.
Import
terraform import imagefactory_azure_china_subscription.china <SUBSCRIPTION_ID>
GCP Project
Manage Google Cloud projects using the imagefactory_gcp_project resource.
resource "imagefactory_gcp_project" "main" {
alias = "production-gcp"
project_id = "my-gcp-project"
access {
type = "service_account"
project_id = "my-gcp-project"
private_key_id = "..."
private_key = "..."
client_email = "..."
client_id = "..."
auth_uri = "https://accounts.google.com/o/oauth2/auth"
token_uri = "https://oauth2.googleapis.com/token"
auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs"
client_x509_cert_url = "..."
}
}
Argument Reference
| Argument | Type | Required/Optional | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the project. |
project_id | String | Required | The GCP project ID. |
access | Block | Required | Service account JSON key fields. |
Import
terraform import imagefactory_gcp_project.main <PROJECT_ID>
Exoscale Organization
Manage Exoscale organizations using the imagefactory_exoscale_organization resource.
resource "imagefactory_exoscale_organization" "main" {
alias = "production-exoscale"
organization_name = "my-org"
access {
api_key = "EXO..."
api_secret = "..."
}
}
Argument Reference
| Argument | Type | Required/Optional | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the organization. |
organization_name | String | Required | The Exoscale organization name. |
access | Block | Required | API credentials. |
Import
terraform import imagefactory_exoscale_organization.main <ORGANIZATION_NAME>
IBM Cloud Account
Manage IBM Cloud accounts using the imagefactory_ibmcloud_account resource.
resource "imagefactory_ibmcloud_account" "main" {
alias = "production-ibm"
account_id = "ibm-account-id"
access {
apikey = "..."
region = "us-south"
cos_bucket = "my-cos-bucket"
resource_group_name = "Default"
resource_group_id = "..."
}
}
Argument Reference
| Argument | Type | Required/Optional | Description |
|---|---|---|---|
alias | String | Required | A friendly name for the account. |
account_id | String | Required | The IBM Cloud account ID. |
access | Block | Required | Authentication and resource details. |
access.apikey | String | Required | IBM Cloud API Key. |
access.region | String | Required | Target region. |
access.cos_bucket | String | Required | Cloud Object Storage bucket for artifacts. |
access.resource_group_name | String | Required | Resource group name. |
access.resource_group_id | String | Required | Resource group ID. |
Import
terraform import imagefactory_ibmcloud_account.main <ACCOUNT_ID>