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

container_app_job: support secrets from Key Vault #25969

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions internal/services/containerapps/container_app_job_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ type ContainerAppJobModel struct {
}

var _ sdk.ResourceWithUpdate = ContainerAppJobResource{}
var _ sdk.ResourceWithCustomizeDiff = ContainerAppJobResource{}

func (r ContainerAppJobResource) ModelObject() interface{} {
return &ContainerAppJobModel{}
Expand Down Expand Up @@ -546,35 +545,3 @@ func (r ContainerAppJobResource) Delete() sdk.ResourceFunc {
},
}
}

func (r ContainerAppJobResource) CustomizeDiff() sdk.ResourceFunc {
return sdk.ResourceFunc{
Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error {
if metadata.ResourceDiff != nil && metadata.ResourceDiff.HasChange("secrets") {
stateSecretsRaw, configSecretsRaw := metadata.ResourceDiff.GetChange("secrets")
stateSecrets := stateSecretsRaw.(*schema.Set).List()
configSecrets := configSecretsRaw.(*schema.Set).List()
// Check there's not less
if len(configSecrets) < len(stateSecrets) {
return fmt.Errorf("cannot remove secrets from Container Apps at this time due to a limitation in the Container Apps Service. Please see `https://github.com/microsoft/azure-container-apps/issues/395` for more details")
}
// Check secrets names in state are all present in config, the values don't matter
if len(stateSecrets) > 0 {
for _, s := range stateSecrets {
found := false
for _, c := range configSecrets {
if s.(map[string]interface{})["name"] == c.(map[string]interface{})["name"] {
found = true
break
}
}
if !found {
return fmt.Errorf("previously configured secret %q was removed. Removing secrets is not supported by the Container Apps Service at this time, see `https://github.com/microsoft/azure-container-apps/issues/395` for more details", s.(map[string]interface{})["name"])
}
}
}
}
return nil
},
}
}
Loading
Loading