The testing environment in TeamCity can be found at https://hashicorp.teamcity.com/
Contents:
Actions in this file require Project Administrator permissions - ask for these if you are unsure if you have them.
At the start, we need to create a project in TeamCity and connect it to our hashicorp/terraform-provider-google repository, so TeamCity can pull in the configuration files to set that project's settings. This will cause all the resources defined in the configuration files to be created within that parent project.
The hashicorp/terraform-provider-google repository contains the entirety of the configuration required for testing both GA and Beta versions of the provider. The process described below only needs to be completed once to provision all required projects.
Note: The steps below require the user to have Admin permissions in TeamCity.
Edit project...
in the top right, and select New subproject...
Create Project
page:From a repository URL
.https://github.com/hashicorp/terraform-provider-google.git
.Proceed
. You'll then be taken to the Create Project From URL
pageImport settings from .teamcity/settings.kts and enable synchronization with the VCS repository
Project name
to an appropriate name, e.g. “Google Cloud”Default branch
is refs/heads/main
.Branch specification
text box; we don't want to monitor branches other than main
.Proceed
.What we‘ve done so far: The process above creates a new project and a VCS Root, through which TeamCity can pull configuration files from GitHub and apply those files to set the new project’s settings. The project's settings will be synchronised with the configuration in GitHub, so if you updated the configuration files in GitHub those changes would automatically be reflected in TeamCity.
The next step is provide some input values that the configuration needs to fully function.
Versioned Settings
in the left menuSynchronization enabled
is selected.Context Parameters
tab at the top of the page.teamcity/settings.kts
Actions
in the top right and click Generate token for a secure value...
Secure value
field nd click Generate Token
.credentialsJSON:<uuid>
Close
Context Parameters
page, create a new entry where the key is credentialsGa
and the value is that secure tokenName | Notes |
---|---|
credentialsGa | USE SECURE TOKENS TO ENTER THIS VALUE. Used to set the GOOGLE_CREDENTIALS environment variable in acceptance tests - GA nightly test project specific |
credentialsBeta | USE SECURE TOKENS TO ENTER THIS VALUE. Used to set the GOOGLE_CREDENTIALS environment variable in acceptance tests - Beta nightly test project specific |
credentialsVcr | USE SECURE TOKENS TO ENTER THIS VALUE. Used to set the GOOGLE_CREDENTIALS environment variable in acceptance tests - VCR test project specific |
Name | Notes |
---|---|
serviceAccountGa | Used to set the GOOGLE_SERVICE_ACCOUNT environment variable in acceptance tests - GA specific |
serviceAccountBeta | Used to set the GOOGLE_SERVICE_ACCOUNT environment variable in acceptance tests - Beta specific |
serviceAccountVcr | Used to set the GOOGLE_SERVICE_ACCOUNT environment variable in acceptance tests - VCR specific |
projectGa | Used to set the GOOGLE_PROJECT environment variable in acceptance tests- GA specific |
projectBeta | Used to set the GOOGLE_PROJECT environment variable in acceptance tests- Beta specific |
projectVcr | Used to set the GOOGLE_PROJECT environment variable in acceptance tests- VCR specific |
projectNumberGa | Used to set the GOOGLE_PROJECT_NUMBER environment variable in acceptance tests - GA specific |
projectNumberBeta | Used to set the GOOGLE_PROJECT_NUMBER environment variable in acceptance tests - Beta specific |
projectNumberVcr | Used to set the GOOGLE_PROJECT_NUMBER environment variable in acceptance tests - VCR specific |
identityUserGa | Used to set the GOOGLE_IDENTITY_USER environment variable in acceptance tests - GA specific |
identityUserBeta | Used to set the GOOGLE_IDENTITY_USER environment variable in acceptance tests - Beta specific |
identityUserVcr | Used to set the GOOGLE_IDENTITY_USER environment variable in acceptance tests - VCR specific |
masterBillingAccountGa | Used to set the GOOGLE_MASTER_BILLING_ACCOUNT environment variable in acceptance tests - GA specific |
masterBillingAccountBeta | Used to set the GOOGLE_MASTER_BILLING_ACCOUNT environment variable in acceptance tests - Beta specific |
masterBillingAccountVcr | Used to set the GOOGLE_MASTER_BILLING_ACCOUNT environment variable in acceptance tests - VCR specific |
org2Ga | Used to set the GOOGLE_ORG_2 environment variable in acceptance tests - GA specific |
org2Beta | Used to set the GOOGLE_ORG_2 environment variable in acceptance tests - Beta specific |
org2Vcr | Used to set the GOOGLE_ORG_2 environment variable in acceptance tests - VCR specific |
billingAccount | Used to set the GOOGLE_BILLING_ACCOUNT ALL environment variable in acceptance tests |
billingAccount2 | Used to set the GOOGLE_BILLING_ACCOUNT_2 environment variable in ALL acceptance tests |
custId | Used to set the GOOGLE_CUST_ID environment variable in ALL acceptance tests |
org | Used to set the GOOGLE_ORG environment variable in ALL acceptance tests |
orgDomain | Used to set the GOOGLE_ORG_DOMAIN environment variable in ALL acceptance tests |
region | Used to set the GOOGLE_REGION environment variable in ALL acceptance tests |
zone | Used to set the GOOGLE_ZONE environment variable in ALL acceptance tests |
infraProject | Used to set an environment variable GOOGLE_INFRA_PROJECT that's used to control the bucket used by VCR testing builds |
vcrBucketName | Used to set an environment variable VCR_BUCKET_NAME that's used to control the bucket used by VCR testing builds |
Save
View configuration settings
in the top right, and clicking Parameters
in the left menu. Credentials values will be obscured as ******
but all other values will be human-readable.When changes to files in .teamcity/
are merged into the main
branch of the hashicorp/terraform-provider-google repository TeamCity will detect these changes and attempt to apply them.
Versioned Settings
page on the parent project.Change Log
tab at the top.Check for changes
button.If an update to the TeamCity configuration isn't valid, for example there is a syntax issue in a Kotlin file, then TeamCity will detect the problem and revert to using the config in the last known good commit.
In scenarios liek this, you will see an error shown at the bottom of the Versioned Settings
page. Builds will continue to run using the last version of the configuration files.
To avoid bugs reaching TeamCity, validate all changes to the TeamCity configuration files locally before merging a PR:
cd .teamcity
make validate