Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show correct deployment name to key vault deployment #226

Merged
merged 2 commits into from
Aug 24, 2022

Conversation

matt-richardson
Copy link
Contributor

While testing out some other changes (stay tuned!) I noticed that the DeploymentName shown for the key vault deployment during the StepValidateTemplate step was showing the name of the main deployment, not the name of the key vault deployment.

This PR passes through the deployment name so it shows the correct name.

Note: I'm a golang newbie, so please go gentle on me

Before

==> azure-arm.azure-arm: Validating deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-8y1h3mp3va'
==> azure-arm.azure-arm:  -> DeploymentName    : 'pkrdp8y1h3mp3va'
==> azure-arm.azure-arm: Deploying deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-8y1h3mp3va'
==> azure-arm.azure-arm:  -> DeploymentName    : 'kvpkrdp8y1h3mp3va'
==> azure-arm.azure-arm:
==> azure-arm.azure-arm: Getting the certificate's URL ...
==> azure-arm.azure-arm:  -> Key Vault Name        : 'pkrkv8y1h3mp3va'
==> azure-arm.azure-arm:  -> Key Vault Secret Name : 'packerKeyVaultSecret'
==> azure-arm.azure-arm:  -> Certificate URL       : 'https://pkrkv8y1h3mp3va.vault.azure.net/secrets/packerKeyVaultSecret/d60b056899fc44f1aed152e842afdd7b
==> azure-arm.azure-arm: Setting the certificate's URL ...
==> azure-arm.azure-arm: Validating deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-8y1h3mp3va'
==> azure-arm.azure-arm:  -> DeploymentName    : 'pkrdp8y1h3mp3va'
==> azure-arm.azure-arm: Deploying deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-8y1h3mp3va'
==> azure-arm.azure-arm:  -> DeploymentName    : 'pkrdp8y1h3mp3va'

After

==> azure-arm.azure-arm: Validating deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-3frb2aa5t7'
==> azure-arm.azure-arm:  -> DeploymentName    : 'kvpkrdp3frb2aa5t7'

==> azure-arm.azure-arm: Pausing after run of step 'StepValidateTemplate'. Press enter to continue. 
==> azure-arm.azure-arm: Deploying deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-3frb2aa5t7'
==> azure-arm.azure-arm:  -> DeploymentName    : 'kvpkrdp3frb2aa5t7'

==> azure-arm.azure-arm: Pausing after run of step 'StepDeployTemplate'. Press enter to continue. 
==> azure-arm.azure-arm: Getting the certificate's URL ...
==> azure-arm.azure-arm:  -> Key Vault Name        : 'pkrkv3frb2aa5t7'
==> azure-arm.azure-arm:  -> Key Vault Secret Name : 'packerKeyVaultSecret'
==> azure-arm.azure-arm:  -> Certificate URL       : 'https://pkrkv3frb2aa5t7.vault.azure.net/secrets/packerKeyVaultSecret/3299cb043a074faab1f6ae2389877dd3'

==> azure-arm.azure-arm: Pausing after run of step 'StepGetCertificate'. Press enter to continue. 
==> azure-arm.azure-arm: Setting the certificate's URL ...
==> azure-arm.azure-arm: Pausing after run of step 'StepSetCertificate'. Press enter to continue. 
==> azure-arm.azure-arm: Validating deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-3frb2aa5t7'
==> azure-arm.azure-arm:  -> DeploymentName    : 'pkrdp3frb2aa5t7'

==> azure-arm.azure-arm: Pausing after run of step 'StepValidateTemplate'. Press enter to continue. 
==> azure-arm.azure-arm: Deploying deployment template ...
==> azure-arm.azure-arm:  -> ResourceGroupName : 'pkr-Resource-Group-3frb2aa5t7'
==> azure-arm.azure-arm:  -> DeploymentName    : 'pkrdp3frb2aa5t7'

@matt-richardson matt-richardson requested a review from a team as a code owner August 16, 2022 11:18
@hashicorp-cla
Copy link

hashicorp-cla commented Aug 16, 2022

CLA assistant check
All committers have signed the CLA.

@matt-richardson matt-richardson marked this pull request as draft August 16, 2022 11:20
Copy link
Contributor

@JenGoldstrich JenGoldstrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @matt-richardson thank you for this, and your other PRs! This one looks good to me, I'm going to merge this and then release the Azure plugin. I will prioritize getting to your other PRs soon.

Thanks again for your contributions!

if actualResourceGroupName != expectedResourceGroupName {
t.Fatal("Expected the step to source 'constants.ArmResourceGroupName' from the state bag, but it did not.")
}
}

func TestStepValidateTemplateShouldTakeDeploymentNameArgumentFromParam(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@JenGoldstrich JenGoldstrich merged commit f99b229 into hashicorp:main Aug 24, 2022
@matt-richardson matt-richardson deleted the bug/fix-deployment-name branch August 25, 2022 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants