Skip to content

Commit

Permalink
fix: move ubuntu ssm ami key into const + fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
lleyton committed Jan 21, 2024
1 parent 7d08986 commit e537568
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/cloud/aws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use k8s_openapi::api::core::v1::Secret;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use tracing::{debug, info, warn};

const DEFAULT_SIZE: &str = "t2.micro";
const UBUNTU_AMI_SSM_KEY: &str =
"/aws/service/canonical/ubuntu/server/22.04/stable/current/amd64/hvm/ebs-gp2/ami-id";

fn default_size() -> String {
String::from(DEFAULT_SIZE)
Expand Down Expand Up @@ -131,7 +134,7 @@ impl Provisioner for AWSProvisioner {
let ssm_client = aws_sdk_ssm::Client::new(&aws_api);
let parameter_response = ssm_client
.get_parameter()
.name("/aws/service/canonical/ubuntu/server/22.04/stable/current/amd64/hvm/ebs-gp2/ami-id")
.name(UBUNTU_AMI_SSM_KEY)
.send()
.await?;
let ami = parameter_response.parameter.unwrap().value.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions src/cloud/digitalocean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ use k8s_openapi::api::core::v1::Secret;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use tracing::{debug, info, warn};

const DROPLET_SIZE: &str = "s-1vcpu-1gb";
const DROPLET_IMAGE: &str = "ubuntu-23-04-x64";

const TOKEN_KEY: &str = "DIGITALOCEAN_TOKEN";


#[derive(Serialize, Deserialize, Debug, Clone, JsonSchema)]
pub struct DigitalOceanProvisioner {
/// Region ID of the DigitalOcean datacenter to provision the exit node in
Expand Down Expand Up @@ -126,7 +126,7 @@ impl Provisioner for DigitalOceanProvisioner {
ip: droplet_ip.clone(),
id: Some(droplet.id.to_string()),
provider: provisioner.clone(),
service_binding: None
service_binding: None,
};

Ok(exit_node)
Expand Down

0 comments on commit e537568

Please sign in to comment.