split upload os image

This commit is contained in:
Serge Logvinov
2021-12-23 09:34:44 +02:00
parent 5ac1525912
commit 21d5114c73
7 changed files with 40 additions and 5 deletions

12
oracle/images/auth.tf Normal file
View File

@@ -0,0 +1,12 @@
# openssl genrsa -out ~/.oci/oci_api_key.pem 2048
# chmod go-rwx ~/.oci/oci_api_key.pem
# openssl rsa -pubout -in ~/.oci/oci_api_key.pem -out ~/.oci/oci_api_key_public.pem
provider "oci" {
tenancy_ocid = var.tenancy_ocid
user_ocid = var.user_ocid
fingerprint = var.fingerprint
private_key_path = var.key_file
region = var.region
}

View File

@@ -6,7 +6,7 @@ resource "random_id" "backet" {
resource "oci_objectstorage_bucket" "images" {
compartment_id = var.compartment_ocid
namespace = data.oci_objectstorage_namespace.ns.namespace
name = "${var.project}-images-${random_id.backet.hex}"
name = "talos-images-${random_id.backet.hex}"
access_type = "NoPublicAccess"
auto_tiering = "Disabled"
}

4
oracle/images/common.tf Normal file
View File

@@ -0,0 +1,4 @@
data "oci_objectstorage_namespace" "ns" {
compartment_id = var.compartment_ocid
}

View File

@@ -0,0 +1,14 @@
variable "compartment_ocid" {}
variable "tenancy_ocid" {}
variable "user_ocid" {}
variable "fingerprint" {}
variable "key_file" {
default = "~/.oci/oci_public.pem"
}
variable "region" {
description = "the OCI region where resources will be created"
type = string
default = null
}

View File

@@ -0,0 +1,9 @@
terraform {
required_providers {
oci = {
source = "hashicorp/oci"
version = "4.56.0"
}
}
}

View File

@@ -3,10 +3,6 @@ data "oci_identity_availability_domains" "main" {
compartment_id = var.compartment_ocid
}
data "oci_objectstorage_namespace" "ns" {
compartment_id = var.compartment_ocid
}
locals {
zones = [for ad in data.oci_identity_availability_domains.main.availability_domains : ad.name]
}