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

Template deployment resource #33

Merged
merged 12 commits into from
Sep 7, 2018

Conversation

thetonymaster
Copy link
Contributor

No description provided.

@ghost ghost added the size/XXL label Aug 24, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

hey @thetonymaster

Thanks for this PR - I've left some comments in-line - but if we can replace the ARM Template/Terraform Configurations being used in the tests which are currently being skipped, we should be able to enable these tests.

Thanks!

name := id.Path["deployments"]
if name == "" {
name = id.Path["Deployments"]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this bug which exists as a remnant of the early-days of Azure should be fixed in Azure Stack - so I think we should be able to normalize this to the lower-case deployments?

name := id.Path["deployments"]
if name == "" {
name = id.Path["Deployments"]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this bug which exists as a remnant of the early-days of Azure should be fixed in Azure Stack - so I think we should be able to normalize this to the lower-case deployments?


func waitForTemplateDeploymentToBeDeleted(ctx context.Context, client resources.DeploymentsClient, resourceGroup, name string) error {
// we can't use the Waiter here since the API returns a 200 once it's deleted which is considered a polling status code..
log.Printf("[DEBUG] Waiting for Template Deployment (%q in Resource Group %q) to be deleted", name, resourceGroup)
Copy link
Contributor

Choose a reason for hiding this comment

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

to confirm: is this still the case for Azure Stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I use the future returned by the SDK I get the error pollingTrackerBase#updateRawBody: failed to unmarshal response body, So my guess is this is still needed.

Copy link
Contributor

Choose a reason for hiding this comment

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

that sounds like a separate bug in the SDK, which would be worth raising on the SDK repository IMO

Copy link
Contributor Author

Choose a reason for hiding this comment

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


_, err = deployClient.Delete(ctx, resourceGroup, name)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

can we wrap this error message? e.g.

return fmt.Errorf("Error deleting Template Deployment %q (Resource Group %q): %+v", name, resourceGroup, err)


read, err := deployClient.Get(ctx, resourceGroup, name)
if err != nil {
return err
Copy link
Contributor

Choose a reason for hiding this comment

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

can we wrap this error message? e.g.

return fmt.Errorf("Error retrieving Template Deployment %q (Resource Group %q): %+v", name, resourceGroup, err)


~> **Note on AzureStack Template Deployments:** Due to the way the underlying Azure API is designed, Terraform can only manage the deployment of the AzureStack Template - and not any resources which are created by it.
This means that when deleting the `azurestack_template_deployment` resource, Terraform will only remove the reference to the deployment, whilst leaving any resources created by that AzureStack Template Deployment.
One workaround for this is to use a unique Resource Group for each AzureStack Template Deployment, which means deleting the Resource Group would contain any resources created within it - however this isn't ideal. [More information](https://docs.microsoft.com/en-us/rest/api/resources/deployments#Deployments_Delete).
Copy link
Contributor

Choose a reason for hiding this comment

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

AFAIK this is still known as an ARM Template Deployment in Azure Stack?

// these values *should* be 'true' and 'false' but,
// due to a bug in the way terraform represents bools at various times these are for now 0 and 1
// see https://github.com/hashicorp/terraform/issues/13512#issuecomment-295389523
// at a later date these may return the expected 'true' / 'false' and should be changed back
Copy link
Contributor

Choose a reason for hiding this comment

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

we can remove this comment as this behaviour is intentional

// Storage account type is not supported
func TestAccAzureStackTemplateDeployment_withOutputs(t *testing.T) {

t.Skip()
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than skip this test we can update it to use a different ARM Template?

// Provider doesn't support resource: azurestack_key_vault_secret
func TestAccAzureStackTemplateDeployment_withParamsBody(t *testing.T) {

t.Skip()
Copy link
Contributor

Choose a reason for hiding this comment

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

we can update this to send a different value via the params body - so we should be able to update this test

// Storage Account type is not supported
func TestAccAzureStackTemplateDeployment_withParams(t *testing.T) {

t.Skip()
Copy link
Contributor

Choose a reason for hiding this comment

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

we should be able to update the ARM Template being used for this to use something else, such that this test can be valid?

@ghost ghost added the size/XXL label Aug 29, 2018
- Change storage account types to supported types
- Change the expected values on tests to be consisting with the
  new storage account types
- Remove for now the unsupported resources and adapt the template
  to use supported resources
@katbyte katbyte added this to the 0.4.0 milestone Sep 6, 2018
Copy link
Collaborator

@katbyte katbyte left a comment

Choose a reason for hiding this comment

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

@thetonymaster,

Thanks for the updates, aside two minor comments that i am going to address myself to get this merged this LGTM!


# azurestack_template_deployment

Create a template deployment of resources
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should be Manage

@ghost ghost added the size/XXL label Sep 7, 2018
@katbyte
Copy link
Collaborator

katbyte commented Sep 7, 2018

tests pass:
screen shot 2018-09-06 at 20 01 22

@katbyte katbyte merged commit bcea5a2 into hashicorp:master Sep 7, 2018
katbyte added a commit that referenced this pull request Sep 7, 2018
@ghost
Copy link

ghost commented Jun 27, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Jun 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants