Skip to content

[WIP] azure: add timeout flag to schedule automatic destroy #507

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anjannath
Copy link
Collaborator

this adds the '--timeout' flag to the 'azure create' commands that schedules a serverless containerapp job on azure that'll destroy the created resources after a delay

@anjannath anjannath changed the title azure: add timeout flag to schedule automatic destroy [WIP] azure: add timeout flag to schedule automatic destroy Jun 11, 2025

// get analytics workspace shared key
shk, err := operationalinsights.GetWorkspaceSharedKeys(ctx, &operationalinsights.GetWorkspaceSharedKeysArgs{
ResourceGroupName: rgName,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this working...I thought I tried something similar in the past... but due to the dependency graph on the pulumi runtime I am not sure that will have a value

this adds the '--timeout' flag to the 'azure <svc> create'
commands that schedules a serverless containerapp job  on
azure that'll destroy the created resources after a delay
when using the '--timeout' flag the backed url needs to be a
remote backed store, this moves the pre-existing check  used
aws to the manager package so its reusable in case of azure
Comment on lines +112 to +122
// add 'Contributor' role to userassigned id to provide permissions to access the resource group
// _, err = authorization.NewRoleAssignment(ctx, resourcesUtil.GetResourceName(a.prefix, a.componentID, "role-assignment"),
// &authorization.RoleAssignmentArgs{
// PrincipalId: principalID,
// PrincipalType: pulumi.String(authorization.PrincipalTypeServicePrincipal),
// RoleDefinitionId: pulumi.String("/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"),
// Scope: a.resourceGroup.ID(),
// })
// if err != nil {
// return err
// }
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@adrianriobo to be able to add the Contributor role to the identity, so that the serverless job is able to destroy the resources, the identity used to create the job needs to be able to have the role to edit Authorization roles, which my accound id currently do not have, so this part is not tested yet

Copy link
Collaborator

Choose a reason for hiding this comment

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

we may need to shift a bit the approach....as I am afraid if any user is not able to create it due to the same issue you are hitting....

What I am thinking of, I think we discussed in the past create the serverless task spec (this can be done on an initial "installation" process which will be managed by an user with admin privileges) and then the timeout will create a trigger for the execution overriding the command args

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants