Skip to content

Commit

Permalink
roachprod: upgrade TF and add arm64 AMIs
Browse files Browse the repository at this point in the history
As of [1], terraform is used in conjunction with roachprod in AWS.
In addition to defining VPCs (and their pair-wise peerings), the generated TF scripts
assign `ami_id` for every region. This information is made available to roachprod
via config.json, generated from TF and embedded into roachprod binary.

Recently, as of [2], `ami_id_fips` was added. This PR adds `ami_id_arm64` in
preparation for arm64-based nightly roachtests. Furthermore, TF is refactored
to make it compatible with versions 0.14 and onwards. Both AWS resources and
the resulting config.json were generated using TF 1.4.6 (latest at this time).

[1] cockroachdb#36418
[2] cockroachdb#99224

Epic: none
Release note: None
  • Loading branch information
srosenberg committed Jun 9, 2023
1 parent 39276c5 commit 5cd66f5
Show file tree
Hide file tree
Showing 14 changed files with 831 additions and 732 deletions.
8 changes: 6 additions & 2 deletions pkg/roachprod/vm/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ func (p *Provider) runInstance(
extraMountOpts = "nobarrier"
}
}
filename, err := writeStartupScript(extraMountOpts, providerOpts.UseMultipleDisks)
filename, err := writeStartupScript(extraMountOpts, providerOpts.UseMultipleDisks, opts.EnableFIPS)
if err != nil {
return errors.Wrapf(err, "could not write AWS startup script to temp file")
}
Expand All @@ -903,12 +903,16 @@ func (p *Provider) runInstance(
return *fl
}

imageID := withFlagOverride(az.region.AMI_X86_64, &providerOpts.ImageAMI)
if opts.EnableFIPS {
imageID = withFlagOverride(az.region.AMI_FIPS, &providerOpts.ImageAMI)
}
args := []string{
"ec2", "run-instances",
"--associate-public-ip-address",
"--count", "1",
"--instance-type", machineType,
"--image-id", withFlagOverride(az.region.AMI, &providerOpts.ImageAMI),
"--image-id", imageID,
"--key-name", keyName,
"--region", az.region.Name,
"--security-group-ids", az.region.SecurityGroup,
Expand Down
4 changes: 3 additions & 1 deletion pkg/roachprod/vm/aws/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ type awsConfig struct {
type awsRegion struct {
Name string `json:"region"`
SecurityGroup string `json:"security_group"`
AMI string `json:"ami_id"`
AMI_X86_64 string `json:"ami_id"`
AMI_ARM64 string `json:"ami_id_arm64"`
AMI_FIPS string `json:"ami_id_fips"`
AvailabilityZones availabilityZones `json:"subnets"`
}

Expand Down
Loading

0 comments on commit 5cd66f5

Please sign in to comment.