Skip to main content

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

ArgumentTypeRequiredDescription
aliasStringRequiredA friendly name for the account.
account_idStringRequiredThe 12-digit AWS account ID.
accessBlockRequiredAuthentication details (see below).
descriptionStringOptionalA description of the account.
propertiesBlockOptionalImage sharing settings (see below).

access block:

ArgumentTypeDescription
role_arnStringRequired. ARN of the IAM role ImageFactory should assume.
role_external_idStringRequired. External ID for the IAM role.

properties block:

ArgumentTypeDescription
aws_share_accountsList of StringAWS account IDs to share images with.
aws_share_organizationsList of StringAWS Organization IDs to share images with.
aws_share_ousList of StringAWS 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

ArgumentTypeRequiredDescription
aliasStringRequiredA friendly name for the account.
account_idStringRequiredThe AWS account ID.
accessBlockRequiredCredentials (see below).
propertiesBlockRequiredRegion and storage settings (see below).
descriptionStringOptionalA description of the account.

access block:

ArgumentTypeDescription
aws_access_key_idStringRequired. AWS access key ID.
aws_secret_access_keyStringRequired. AWS secret access key.

properties block:

ArgumentTypeDescription
regionStringRequired. Target AWS China region.
s3_bucket_nameStringRequired. S3 bucket name for build artifacts.
aws_share_accountsList of StringOptional. 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

ArgumentTypeRequired/OptionalDescription
aliasStringRequiredA friendly name for the subscription.
subscription_idStringRequiredThe Azure subscription ID.
accessBlockRequiredAuthentication details.
access.tenant_idStringRequiredAzure AD Tenant ID.
access.app_idStringRequiredService Principal Application ID.
access.passwordStringRequiredService Principal Client Secret.
access.resource_group_nameStringRequiredResource group for build resources.
access.storage_accountStringRequiredStorage account for build artifacts.
access.storage_account_keyStringRequiredAccess key for the storage account.
access.shared_image_galleryStringRequiredName 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

ArgumentTypeRequired/OptionalDescription
aliasStringRequiredA friendly name for the project.
project_idStringRequiredThe GCP project ID.
accessBlockRequiredService 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

ArgumentTypeRequired/OptionalDescription
aliasStringRequiredA friendly name for the organization.
organization_nameStringRequiredThe Exoscale organization name.
accessBlockRequiredAPI 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

ArgumentTypeRequired/OptionalDescription
aliasStringRequiredA friendly name for the account.
account_idStringRequiredThe IBM Cloud account ID.
accessBlockRequiredAuthentication and resource details.
access.apikeyStringRequiredIBM Cloud API Key.
access.regionStringRequiredTarget region.
access.cos_bucketStringRequiredCloud Object Storage bucket for artifacts.
access.resource_group_nameStringRequiredResource group name.
access.resource_group_idStringRequiredResource group ID.

Import

terraform import imagefactory_ibmcloud_account.main <ACCOUNT_ID>